GetListItems: Only those items for which particular field value is not null

Oct 23, 2013 at 3:50 PM
Hi,
Thanks for this wonderful tool.
I am using SPServices to query my list and I want to return only those items for which a particular field value is not null. for example
Name Id
John 001X
Kelly 002T
Mark
Harry 00LX

SPServices returns all 4 records and it returns Id field for Mark as 'Undefined'. Is there a way so that SPServices only returns only 3 records for above list?

Thanks in advance!
Coordinator
Oct 23, 2013 at 3:54 PM
Edited Oct 23, 2013 at 4:39 PM
Try adding a CAMLQuery like this:
CAMLQuery: "<Query><Where><Neq><FieldRef Name='Id' /><Value Type='Text'></Value></Neq></Where></Query>",
Alternatively, you can just test for the undefined value on the client side, depending on what you're trying to do.

M.
Oct 23, 2013 at 4:37 PM
Thank you for quick response!
It seems to have some problem with <Neq>. following didn't work
"<Query><Where><Neq><FieldRef Name='Participant_x0020_ID'></FieldRef><Value Type='Text'></Value></Neq></Where></Query>",

But this worked..
"<Query><Where><IsNotNull><FieldRef Name='Participant_x0020_ID'></FieldRef></IsNotNull></Where></Query>",


Thanks again!
Coordinator
Oct 23, 2013 at 4:40 PM
Sorry about that. I should have tested it before I posted it. I also left out the <Where> elements (fixed above).

M.
Oct 23, 2013 at 4:43 PM
No problem. Thanks again for sharing your great work!
Have a great day!