Quantcast
Channel: jQuery Library for SharePoint Web Services
Viewing all articles
Browse latest Browse all 6517

New Post: SPService Fetch data problem

$
0
0
<p>As a point of reference, I run GetListItems operations (with a CAMLQuery option) on a list that has more than 12,000 records quite regularly.&nbsp; The query returns a set of 1-15 records on average and can do so in about 1-2 seconds.&nbsp; I'm only filtering on one field, however.&nbsp; I noticed your syntax for the CAMLQuery looks odd.&nbsp; It doesn't appear you're nesting your &lt;And&gt; tags properly.&nbsp; When you break yours out, it appears like...</p><div style="color: black; background-color: white;"><div style="color: black; background-color: white;"><pre>&lt;Query&gt;&lt;Where&gt;&lt;And&gt;&lt;Eq&gt;&lt;FieldRef Name=<span style="color: #a31515;">'User_x003a_ID'</span> /&gt;&lt;Value Type=<span style="color: #a31515;">'Lookup'</span>&gt;<span style="color: #a31515;">"+rowUserId+"</span>&lt;/Value&gt;&lt;/Eq&gt;&lt;And&gt;&lt;Eq&gt;&lt;FieldRef Name=<span style="color: #a31515;">'Role_x003a_ID'</span> /&gt;&lt;Value Type=<span style="color: #a31515;">'Lookup'</span>&gt;<span style="color: #a31515;">"+rowRoleId+"</span>&lt;/Value&gt;&lt;/Eq&gt;&lt;And&gt;&lt;Eq&gt;&lt;FieldRef Name=<span style="color: #a31515;">'Skill_x0020_Category_x003a_ID'</span> /&gt;&lt;Value Type=<span style="color: #a31515;">'Lookup'</span>&gt;<span style="color: #a31515;">"+rowCategoryId+"</span>&lt;/Value&gt;&lt;/Eq&gt;&lt;Eq&gt;&lt;FieldRef Name=<span style="color: #a31515;">'Skill_x0020_Group_x003a_ID'</span> /&gt;&lt;Value Type=<span style="color: #a31515;">'Lookup'</span>&gt;<span style="color: #a31515;">"+rowGroupId+"</span>&lt;/Value&gt;&lt;/Eq&gt;&lt;/And&gt;&lt;/And&gt;&lt;/And&gt;&lt;/Where&gt;&lt;/Query&gt;</pre></div></div><div style="color: black; background-color: white;">Try re-constructing your CAML to look like the example below and see if it makes a difference</div><p></p><div style="color: black; background-color: white;"><pre>&lt;Query&gt;&lt;Where&gt;&lt;And&gt;&lt;And&gt;&lt;Eq&gt;&lt;FieldRef Name=<span style="color: #a31515;">'User_x003a_ID'</span> /&gt;&lt;Value Type=<span style="color: #a31515;">'Lookup'</span>&gt;<span style="color: #a31515;">"+rowUserId+"</span>&lt;/Value&gt;&lt;/Eq&gt;&lt;Eq&gt;&lt;FieldRef Name=<span style="color: #a31515;">'Role_x003a_ID'</span> /&gt;&lt;Value Type=<span style="color: #a31515;">'Lookup'</span>&gt;<span style="color: #a31515;">"+rowRoleId+"</span>&lt;/Value&gt;&lt;/Eq&gt;&lt;/And&gt;&lt;And&gt;&lt;Eq&gt;&lt;FieldRef Name=<span style="color: #a31515;">'Skill_x0020_Category_x003a_ID'</span> /&gt;&lt;Value Type=<span style="color: #a31515;">'Lookup'</span>&gt;<span style="color: #a31515;">"+rowCategoryId+"</span>&lt;/Value&gt;&lt;/Eq&gt;&lt;Eq&gt;&lt;FieldRef Name=<span style="color: #a31515;">'Skill_x0020_Group_x003a_ID'</span> /&gt;&lt;Value Type=<span style="color: #a31515;">'Lookup'</span>&gt;<span style="color: #a31515;">"+rowGroupId+"</span>&lt;/Value&gt;&lt;/Eq&gt;&lt;/And&gt;&lt;/And&gt;&lt;/Where&gt;&lt;/Query&gt;</pre></div><p>This way, your conditions are all grouped in pairs, nests of pairs.</p><p>Geoff</p>

Viewing all articles
Browse latest Browse all 6517

Trending Articles