I need help with expression for sorting both ascending and descending for the same data.
I can have multiple expression separated by pipe but i can't seem to find any example that does both ASC and DESC in the same call.
So what i am looking for is equal to following sql query.
select * from dummyData order by id, code desc, update_only
Here is sample.
[ {"id": 1,"code": "y","update_only": 0.0 }, {"id": 2,"code": "a","update_only": 0.0 }, {"id": 1,"code": "z","update_only": 0.0 }, {"id": 2,"code": "b","update_only": 0.0 }]
I can do following for the ordering
sort_by(array elements, expression->number|expression->string expr)
How can i do the following with one call rather than the two calls that i have?
sort_by(myarray, &id | &update_only)[];reverse(sort_by(myarray, &code))[];
Or by doing multiple calls, don't want to do this as well.
result1 = sort_by(myarray, &id)[];result2 = reverse(sort_by(result1, &code))[];resilt3 = sort_by(myarray, &update_only)[];