Reputation: 35335
I have a calculated field in my list and I am trying to use filter on this field. For some reason, the following query always returns all items instead of a filtered item collection:
var spQuery = new SPQuery
{
Query = @"<Where><Geq><FieldRef Name='Score' /><Value Type='Calculated'>10000</Value></Geq></Where><OrderBy><FieldRef Name='Modified' Ascending='True' /></OrderBy>",
RowLimit = 200,
ViewFields = @"<FieldRef Name='Username' />"
};
var spList = web.Lists["Users"];
var spListItemCollection = spList.GetItems(spQuery);
Upvotes: -1
Views: 2019
Reputation: 6988
Try removing ViewFields section (to get all columns, also those that are needed for calculation) or set SPQUery.IncludeMandatoryColumns
Upvotes: 0