1

I had written the below line to sort multiple fields using CAML query, But it's not working. Can any one help what's the issue.

camlQuery.set_viewXml("<View><Query><Where><Eq><FieldRef Name='Month' /><Value Type='Text'>"+mymonthvalue+"</Value></Eq></Where><OrderBy><FieldRef Name='Sub%5Fx002d%5FOrder' Ascending='TRUE' /><FieldRef Name='Order' Ascending='TRUE' /></OrderBy></Query></View>");
  • Check the internal name of the field, Sub%5Fx002d%5FOrder. Moreover, try using CAML Query Builder: u2u.be/software – Nadeem Yousuf Mar 6 '18 at 8:59
0

Like mentioned above, it should work with Sub_x002d_Order, if not there is some other problem.

<View>
    <Query>
        <Where>
            <Eq>
                <FieldRef Name='Month' /><Value Type='Text'>"+mymonthvalue+"</Value>
            </Eq>
        </Where>
        <OrderBy>
            <FieldRef Name='Sub_x002d_Order' Ascending='TRUE' />
            <FieldRef Name='Order' Ascending='TRUE' />
        </OrderBy>
    </Query>
</View>
  • I was missing 0 at the end of to Column Name "Order" – MSA Mar 6 '18 at 12:00
1

Change your field name - the %5F should be an underline. The internal field names use _x0020_ to represent the space and _x002d_ to represent the dash.

  • I had converted the name from "Sub%5Fx002d%5FOrder" to "Sub_x0020_Order" . But I found no luck – MSA Mar 6 '18 at 7:09
  • As the others mentioned, change it to Sub_x002d_Order. You don't have a space, you have a dash. – Robin in Or Mar 7 '18 at 17:56

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.