4.6 Sort according to specified order

 

Sort score table according to the order of student list. Below are involved tables:

Student list:

ID Name
1 Rebecca
2 Ashley
3 Rachel
4 Emily
5 Nancy
6 Alice
7 Andrew
8 Janet
9 Sunny
10 Margaret
11 Steven
12 Michael
13 Robert
14 Laura
15 Anne
16 Peter

Score table:

Name Score
Andrew 70
Ashley 74
Emily 68
Janet 63
Laura 98
Margaret 76
Michael 80
Nancy 99
Rachel 91
Robert 50
Steven 84

SPL script:

A
1 =T(“students.xlsx”)
2 =T(“score.xlsx”).align(A1:Name,Name)

A2 uses align function to align score table to student list according to Name values.

Execution result:

Name Score
Rebecca
Ashley 74
Rachel 91
Emily 68
Nancy 99
Alice
Andrew 70
Janet 63
Sunny
Margaret 76
Steven 84
Michael 80
Robert 50
Laura 98
Anne
Peter