cancel
Showing results for 
Search instead for 
Did you mean: 

Sorting Table Column with Numbers or Currency Values

Former Member
0 Kudos

Hi All,

I have a problem with the default sort option in the VC Table. All the VC Table columns are of Text type. We have 2 columns in a table which are numbers and Currency fields. The default ascending / descending sort option in the table seem to not work properly.

In the numbers if I have an order something like...

24

4

52

When I sort descending it comes as

52

4

24

and ascending is just swapping of 24 and 52. This seems to be wrong. Has anyone come across this issue?

Thanks,

Nagarajan.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

You are sorting text fields, and thiis why you are getting this order. when sorted as text, 24 will come before 4, because it starts with a 2.

If you want to sort by numbers, I suggest you add a column to the table which will be an expression box with a "number" data type. Now you can assign in the expression fileld- "NVAL(@XXX)", when XXX is the text field you want to sort by. Now clicking on the expression boc column header will sort by numbers.

You can also make the XXX field invisible, so it will not be displayed twice.

Best regards,

Udi