How to use where clause in GetListItems?

May 3, 2010 at 10:30 AM

Hi, i'm not able to use the query clause using GetListItems.

I need to insert this condition in the code: <Where><Eq><FieldRef Name="ID" /><Value Type="Counter">25</Value></Eq></Where>

 

$().SPServices({
            operation: "GetListItems",
            listName: ListName',
            CAMLViewFields:'<Query><ViewFields><FieldRef Name="Title"/><FieldRef Name="Commodity"/>'
             + '<FieldRef Name="Applications_x0020_Model"/><FieldRef Name="Average_x0020_APV_x0020_of_x00200"/>'
             + '<FieldRef Name="Average_x0020_APV_x0020_of_x0020"/><FieldRef Name="Currency"/>'
             + '<FieldRef Name="Buyer_x0020_of_x0020_reference"/><FieldRef Name="Commodity_x0020_Manager_x0020_of"/>'
             + '<FieldRef Name="Components"/><FieldRef Name="Notes1"/><FieldRef Name="Recommended_x0020_Supplier"/>'
             + '<FieldRef Name="Sectors"/><FieldRef Name="Sourcing_x0020_Phase"/>'
             + '<FieldRef Name="Sourcing_x0020_Type"/><FieldRef Name="Date"/>'
             + '<FieldRef Name="Table"/><FieldRef Name="State"/></ViewFields>',
            CAMLQueryOptions:'<QueryOptions><ViewAttributes Scope="Recursive" /></QueryOptions>',         
            async: false,
            completefunc: function (xData, Status) {
                var v = $(xData.responseXML).find("[nodeName=z:row]").each(function() {
                 //...
                });
            }
        });
       

May 3, 2010 at 10:52 AM

Problem solved: i have to add this line of code: CAMLQuery: '<Query><Where><Eq><FieldRef Name="ID" /><Value Type="integer">25</Value></Eq></Where></Query>',

 

Coordinator
May 3, 2010 at 11:35 AM

My favorite type of discussion: the kind where the person solves their own problem!

Glad you got it worked out, and let me know if you get stuck on anything else.

M.