Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Ok I found my answer : </p> <p>You can add a where clause even on the foreign list, but the targeted field can't be a Boolean :( because there are supported types (<a href="http://msdn.microsoft.com/en-us/library/ee535502.aspx" rel="nofollow">ProjectedFields</a>). Actually if you want to filter the foreign list on its specific field, you might wanna declare it in the projected fields element so that they are recognized in your where clause in the Query property of SPQuery. </p> <p>For example, in the previous case, </p> <pre><code> SPList spl = web.GetList(customers); SPQuery query = new SPQuery(); query.Query = @"&lt;Where&gt;&lt;And&gt; &lt;Eq&gt;&lt;FieldRef Name='Suspended'/&gt;&lt;Value Type='Boolean'&gt;0&lt;/Value&gt;&lt;/Eq&gt; &lt;Eq&gt;&lt;FieldRef Name='ContinentCountryList' List="CountryList"/&gt;&lt;Value Type='Text'&gt;Europe&lt;/Value&gt;&lt;/Eq&gt; &lt;/And&gt;&lt;/Where&gt;"; query.Joins=@"&lt;Join Type='Inner' ListAlias='CountryList'&gt;&lt;Eq&gt;&lt;FieldRef Name='Country' RefType='Id'/&gt;&lt;FieldRef List='CountryList' Name='ID'/&gt;&lt;/Eq&gt; &lt;/Join&gt;"; query.ProjectedFields = "&lt;Field Name='ContinentCountryList' Type='Lookup' List='CountryList' ShowField='Continent'/&gt; </code></pre> <p>Now this is working I'll get not suspended customers from towns in Europe only. So I must reference my foreign field in the projectedFields element. But it's only working with types listed above in the msdn link...</p> <p>too bad for me it was a boolean, I guess I must deal with temporary lists in memory unless you have any other suggestions...</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload