4.2 Sort row-wise data by single field

 

Below is math test result where scores of absentees are recorded as null. The task is to sort the table by score.

Class Name Math
1 Tom 85
2 John 92
2 Joan 86
1 Rocky 95
2 Ham 92
1 Kate 83
1 Rose 95
2 Nomy 78
1 Neil 91
2 Jack
1 Joe 98

SPL script:

A
1 =T(“score.xlsx”)
2 =A1.sort(Math)
3 =A1.sort@z(Math)
4 =A1.sort@0(Math)
5 =A1.sort@z0(Math)

A1 Retrieve data.
A2 Sort A1 by Math field in ascending order; the null value is by default treated as the smallest value.
A3 Sort A1 by Math field in descending order; the null value is by default treated as the smallest value.
A4 Sort A1 by Math field in ascending order; @o option enables treating null as the largest value.
A5 Sort A1 by Math field in descending order; @o option enables treating null as the largest value.

Execution result:

A2:

imagepng

A3:

imagepng

A4:

imagepng

A5:

imagepng