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>");
1
  • Check the internal name of the field, Sub%5Fx002d%5FOrder. Moreover, try using CAML Query Builder: u2u.be/software Commented Mar 6, 2018 at 8:59

2 Answers 2

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>
1
  • I was missing 0 at the end of to Column Name "Order"
    – MSA
    Commented Mar 6, 2018 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.

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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