0

I am trying to filter two fields or more that is clean of null values.

It works for the first field but it is not working for the second field:

<View><Query><Where><IsNotNull><FieldRef Name='CustomField'/></IsNotNull><IsNotNull><FieldRef Name='LaborCategory'/></IsNotNull></Where></Query></View>
  • What is the data type of LaborCategory and CustomField columns? – Ganesh Sanap Oct 18 at 6:34
0

You need nested query. For each column you need to add AND/OR in query. See this answer https://stackoverflow.com/a/6204309/4069473

| improve this answer | |
  • I tried this solution but got undefined as well – kont Oct 17 at 11:13
0

Try using below CAML query:

<View>
  <Query>
    <Where>
      <AND>
        <IsNotNull><FieldRef Name='CustomField'/></IsNotNull>
        <IsNotNull><FieldRef Name='LaborCategory'/></IsNotNull>
      </AND>
    </Where>
  </Query>
</View>

Official documentations:

  1. IsNotNull element (Query)
  2. CAML Query schema
| improve this answer | |
  • it does not work actually because am trying to iterate the list to get two results and i think i cant do that, so that i did function for each one – kont Oct 18 at 20:16
  • here is what am trying to do after mapping the caml query: while (listItemEnumerator1.moveNext()) { var oListItem1 = listItemEnumerator1.get_current(); $("#labcategory").append('<option>' + oListItem1.get_item('LaborCategory') + '</option>') $("#company").append('<option>' + oListItem1.get_item('CustomField') + '</option>') } – kont Oct 18 at 20:17

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.