I have number greater than 10 digit and that stored as a text and I want sort them. I have tried with sortextarray() that is sorting based on ascii values so it is not giving me correct output. and I tried to convert into int but that is giving me infinity Please help me here to sort the array.
Thanks in advance.
Discussion posts and replies are publicly visible
Pad all strings with spaces to make text sort working, then sort and remove the spaces.
a!localVariables( local!numbers:{"99", "10", "9999999999999", "3504051867", "1", "350405187","350405188","350405189","3604051899","360405189"}, trim( todatasubset( a!forEach( items: local!numbers, expression: a!map(value: padleft(fv!item, 20)) ), a!pagingInfo( startIndex: 1, batchSize: -1, sort: a!sortInfo( field: "value", ascending: true ) ) ).data.value ) )
Thanks For the solution
Definitely like Stewart's approach the most.
a!localVariables( local!data: {"3504051867","350405187","350405188","350405189","3604051899","360405189"}, index( index( todatasubset( a!forEach( items: local!data, expression: a!map( decimalNumber: todecimal(fv!item), textNumber: fv!item ) ), a!pagingInfo( startIndex: 1, batchSize: -1, sort: a!sortInfo( field: "decimalNumber", ascending: false ) ) ), "data", {} ), "textNumber", {} ) )
...and you can be defensive here as well to exclude any value that inherently isn't a number...
Can You use this Approach in Readonly grid ?if yes can you help me out?
Yes, you can. Where are you stuck?