Hi,
I have an array of CDT, which have a string field and an integer field for example.
And i want to sort the array of CDT with the field of integer. The integer have repeated numbers.
Any suggestion?
Thanks
Discussion posts and replies are publicly visible
The following snippet should help you - local!field would be the field name you want to sort on.
cast( typeof(local!cdt), todatasubset( local!cdt, a!pagingInfo( startIndex: 1, batchSize: -1, sort: a!sortInfo( field: local!field, ascending: local!ascending ) ) ).data )
Hi Josh,
is it possible to sort on two field in a CDT? just like in SQL, it can set like "ORDER BY Field1 ASC, Field2 ASC".
regards,
Lin
i think I know it now. thanks.
Yes. When sorting using an a!pagingInfo() object, an array of a!sortInfo() objects may be passed in and all of them will be used (in order) to sort the resulting array.