Sort In Expression Not Working

Hi.
I have to sort the response based on one of the fields. The data is being fetched from API.
I have created a server API action and a server connect to use it.
In my repeater, I have set the expression to server connect and added sort data formatter.

image
scLP.data.api1.data.LP.sort(Order)

The field Order contains numbers (1,2,3…) and is received as string from API. I even tried by making the API send numeric value, but its not working.
Please help.

1 Like

you can use API parameters for sort option

hi @patrick… still facing this issue. Irrespective of data type. Sorting does not work for string or number.
This is the client side sort formatter. Please help.

requesting help on this please.

also, ID (INT field in DB) is being read as a string and sorted as string when sorting added on the query builder directly.

image

The property for the sort should be inside quotes

scLP.data.api1.data.LP.sort('Order')

Is it MySQL you are using? There are several topics about MySQL returning values as string instead of number. This is a driver issue, with PHP PDO you have to use the native driver and set prepared statements to false. For ASP/.NET I don’t know how to solve it.

yes, using MySQL

this is how i got sorting to work in our setup:

scOrdersStatesTo.data.queryOrderStatesTo.where(`ID`, collapseFilters.selectFilterOrderState.value[0], "!=").sort(ID.toNumber())

thanks.