Skip to main content
2 of 4
better example
Chad
  • 770
  • 4
  • 11

CAML uses xml format, which means you need to "wrap" your elements in opening and closing tags. For an "And" condition, it would look like this:

<And>...</And>

For an "Or" condition it would look like this:

<Or>...</Or>

You can nest them if needed like this:

<Or><And>...</And><And>...</And></Or>

The "..." in each example is your <Eq><FieldRef.../><Value.../></Eq> or Neq or whatever comparison you're trying to make.

To make yours work it would be something like:

"<And>[Other And Conditions Here]" +
"<Or>" +
"<Eq><FieldRef Name='COMPETENCIA_x003a_ID' /><Value Type='Text'>" + arr_competencia_temp[0] + "</Value></Eq>" +
"<Eq><FieldRef Name='COMPETENCIA_x003a_ID' /><Value Type='Text'>" + arr_competencia_temp[1] + "</Value></Eq>" +
"</Or></And>"

... 2...3...4...etc. you would need to append each option dynamically if they exist, use a for loop over the arr_competencia_temp array.

Chad
  • 770
  • 4
  • 11