I know that this query works fine
SPQuery query = new SPQuery();
query.Query = "<OrderBy><FieldRef Name='ItemChildCount' Ascending='FALSE' /></OrderBy>";
But my SPListItemCollection doesn't display what I'm expecting as a result.
Actual Dispaly in C# Actual Display in CAML Query Builder ID | Title | ItemChildCount| ID | Title | ItemChildCount | ---|-------|---------------| ---|-------|----------------| 11 | Abc | 11;#5 | 11 | Abc | 5 | ---|-------|---------------| ---|-------|----------------| 22 | BBB | 22;#9 | 22 | BBB | 9 | ---|-------|---------------| ---|-------|----------------| 24 | Cbc | 24;#7 | 24 | Cbc | 7 |
I wonder why in U2U CAML Query Builder, the sort by ItemChildCount doesn't work. I tried to sort the items by ItemChildCount yet it sorts the ID instead.
But, when I check on the result on C# code immediate window using SPListItem["ItemChildCount"] it displays the concatenated ID and the ItemChildCount resulting to something like this 11;#5.
How will I create a query where I can do some string manipulations on the CAML query. Something like this
Select * from ListCollection Order by ItemChildCount.Replace("11;#","")
If ever this is possible.