Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I've been struggling with listbox sorting for a couple of days. I hope someone can assist. My listbox has a field and 2 expressions. I am not able to get it to sort by Description (1st expression). I am able to sort by Sales (2nd expression). I have also tried doing the sort in the load script but that has not helped either. See screenshot of all 3 tests. Attached is my qvw. I am using QV 12.4 SR3.
Hi @VivenReddy, sort by expression expects a number to sort, you can try with:
Ord(Left(Lower(Description),1))*1e6+Ord(Mid(Lower(Description),2,1))*1e3+Ord(Mid(Lower(Description),3,1))
At least to sort by the fist 3 letters.
Another option can be:
Num((Ord(Left(Lower(Description),1))-96),'00')
&Num((Ord(Mid(Lower(Description),2,1))-96),'00')
&Num((Ord(Mid(Lower(Description),3,1))-96),'00')
...
But it will be better if you can add another field to each description that sets the order of the Descriptions, something Like:
Left Join(DataTable)
LOAD Distinct Description,
RecNo() as DescriptionOrder
Resident DataTable
Order By Description;
So you can use Min({1} DescriptionOrder) to sort values
Hi @VivenReddy, sort by expression expects a number to sort, you can try with:
Ord(Left(Lower(Description),1))*1e6+Ord(Mid(Lower(Description),2,1))*1e3+Ord(Mid(Lower(Description),3,1))
At least to sort by the fist 3 letters.
Another option can be:
Num((Ord(Left(Lower(Description),1))-96),'00')
&Num((Ord(Mid(Lower(Description),2,1))-96),'00')
&Num((Ord(Mid(Lower(Description),3,1))-96),'00')
...
But it will be better if you can add another field to each description that sets the order of the Descriptions, something Like:
Left Join(DataTable)
LOAD Distinct Description,
RecNo() as DescriptionOrder
Resident DataTable
Order By Description;
So you can use Min({1} DescriptionOrder) to sort values
Thank you for your response Ruben.