As shown in the following JSL, sorting works correctly in ascending order when only numbers are present; however, when mixed with text, converting to numbers before sorting causes issues. What methods can be used to solve this problem?
stepList = {"2", "3", "10", "9", "1"};
stepListSort = Sort List( stepList );
stepListNum = {};
For( i = 1, i <= N Items( stepList ), i++,
Insert Into( stepListNum, Num( stepList[i] ) )
);
stepListNumSort = Sort List( stepListNum );
stepListWithString = {"2", "3", "10_New", "9", "1"};
stepListWithStringSort = Sort List( stepListWithString );
Show( stepListWithSting );
stepListNum = {};
For( i = 1, i <= N Items( stepList ), i++,
Insert Into( stepListNum, Num( stepListWithString[i] ) )
);
stepListWithStringNumSort = Sort List( stepListNum );