Hi,
I have an array of CDT ABC:
{
{ Id: 111111, position: L1}
{ Id: 22222, position: R2}
{ Id: 333, position: L2}
{ Id: 44, position: R1}
{ Id: 555, position: L3}
{ Id: 666, position: R3}
}
Now I need to sort this array as
Can someone give me some hint?
Thanks,
Peiran
Discussion posts and replies are publicly visible
Pass it through the toDataSubset() function, using a sort parameter that sorts on the column you'd like. If you'll be doing this all the time but on different CDTs, I'd suggest you set up an expression rule that takes in the CDT to sort, the field you want to sort on, and true/false value for whether the sort should be in ascending or descending order.
Ah yes, todatasubset() will work for this scenario as well since the desired sort is in fact in alphabetical order!
a!localVariables( local!cdt: { { Id: 111111, position: "L1"}, { Id: 22222, position: "R2"}, { Id: 333, position: "L2"}, { Id: 44, position: "R1"}, { Id: 555, position: "L3"}, { Id: 666, position: "R3"} }, todatasubset( local!cdt, a!pagingInfo(1,-1,a!sortInfo("position",true)) ).data )
Yeah, this is what I was thinking of.