1

I have a list with two choices:

"<Field Type='Choice' Name='Result' Format='RadioButtons'> "
                         + "<Default> </Default>"
                         + "<CHOICES>"
                         + "    <CHOICE>OK</CHOICE>"
                         + "    <CHOICE>NON OK</CHOICE>"
                         + "</CHOICES>"
                         + "</Field>";

By default, when no choice is selected, the list shows a "blank" value, and it's ok for me.

Now, I know how to write in JSOM the CAML query to get the number items with a choice value, for example this to get the number of "OK" values:

var camlQuery = new SP.CamlQuery();
    camlQuery.set_viewXml(
        '<View><Query><Where><Eq>' +
        '<FieldRef Name=\'Result\'/><Value Type=\'Choice\'>OK</Value>' +
        '</Eq></Where></Query></View>');

but how to get the number of "blank" items?

Of course I have tried with this but doesn't work:

var camlQuery = new SP.CamlQuery();
    camlQuery.set_viewXml(
        '<View><Query><Where><Eq>' +
        '<FieldRef Name=\'Result\'/><Value Type=\'Choice\'></Value>' +
        '</Eq></Where></Query></View>');
0

Try using following code in your query:

"<Query><Where><IsNull><FieldRef Name='Result' /></IsNull></Where></Query>"
  • This query is "quite" right. I have tried it and returns the number of all items (6 in my case), while only 2 are "blanks". maybe there is something like "IsEmpty"? – spiderman Oct 19 '18 at 9:30
  • I am afraid, there is nothing as such "IsEmpty". you can get the query schema documentation here. and IsNull element details, here. – Ganesh Sanap Oct 19 '18 at 9:35
  • does this answers your question? – Ganesh Sanap Nov 15 '18 at 11:50
  • 1
    No, At last I have done the "negative" query to find the Empty items (like where not 'OK' AND not 'NON OK') – spiderman Nov 15 '18 at 14:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.