Deduplicate without Changing Original Order
Example
The Excel file book1.xlsx has two columns of Car and Color. Part of the data is shown in the figure below:
The task is to delete the repeated colors in each car category without changing the original data order, as shown in the following figure:
Write SPL script:
A |
|
1 |
=T("E:/car/book1.xlsx") |
2 |
=A1.group@p1(Car,Color) |
3 |
=A1(A2.sort()) |
4 |
=T("E:/car/book2.xlsx",A3) |
A1 Read the data of book1.xlsx
A2 Group the data by Car and Color, the @p option means to return the sequence of numbers formed by the position of the group members in A1, and 1 means to take only the first record of each group after grouping
A3 After sorting the sequence in A2, take out the records of the corresponding sequence numbers from A1 in the order
A4 Store the result in A3 to book2.xlsx
SPL Official Website 👉 https://www.scudata.com
SPL Feedback and Help 👉 https://www.reddit.com/r/esProc_Desktop/
SPL Learning Material 👉 https://c.scudata.com
Discord 👉 https://discord.gg/cFTcUNs7
Youtube 👉 https://www.youtube.com/@esProcDesktop
Linkedin Group 👉 https://www.linkedin.com/groups/14419406/