0

I am trying to get items that have travelDate lesser than 30 days before today. and then orderby traveldate

But the below query doesn't seem to work

<OrderBy>
        <FieldRef Name='TravelDate' Ascending='False'/>
            <Value Type='DateTime' IncludeTimeValue='False'></Value>
    </OrderBy>
<Where>
    <Leq>
        <FieldRef Name='TravelDate' /><Value Type='DateTime'><Today OffsetDays='-30' /></Value>
    </Leq>
</Where>

what is wrong with the query? both the orderby and LEQ doesn't seem to work

1 Answer 1

2

Looks like I haven't enclosed the query with <View><Query> tags

<View><Query>
<OrderBy>
        <FieldRef Name='TravelDate' Ascending='False'/>
            <Value Type='DateTime' IncludeTimeValue='False'></Value>
    </OrderBy>
<Where>
    <Leq>
        <FieldRef Name='TravelDate' /><Value Type='DateTime'><Today OffsetDays='-30' /></Value>
    </Leq>
</Where>
</Query></View>

the above query worked just fine

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.