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:
A3:
A4:
A5:
SPL Official Website 👉 https://www.scudata.com
SPL Feedback and Help 👉 https://www.reddit.com/r/esProcSPL
SPL Learning Material 👉 https://c.scudata.com
SPL Source Code and Package 👉 https://github.com/SPLWare/esProc
Discord 👉 https://discord.gg/cFTcUNs7
Youtube 👉 https://www.youtube.com/@esProc_SPL