6

I have 3 Columns in my List

Id Name SortBy
1 A 1
2 B
3 C 2
4 D 3

and my CAML query is :

 Query = @"<OrderBy><FieldRef Name='SortOrder' Ascending='False' /></OrderBy>"

and I am getting following result :

Id Name SortBy
2 B
1 A 1
3 C 2
4 D 3

Null value in SortBy Column is displayed at first place. I want to ignore this null value, null value should be displayed in the end. Is there any way by which I can achieve this

My Expected result

Id Name SortBy

1 A 1
3 C 2
4 D 3
2 B

  • @AtishDipongkor Query is working fine only filtering is an issue – BASEER HAIDER JAFRI Nov 6 '15 at 6:45
5

Create a calculated column that would calculate if your sort column is not NULL. The formula could look like this =IF(ISBLANK([ColumnName]),0,1) and the result can be 'Yes/No'. Now you can make sorting in your CAML by two columns (the new calculated and later your real column):

<OrderBy>
   <FieldRef Name='MyIsBlankCalculatedColumn' Ascending='False' />
   <FieldRef Name='SortOrder' Ascending='False' />
</OrderBy>

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.