Remove Empty Values and Move Next Ones Up
【Question】
I want to print party address with partyname,add1,add2,add3,add4 in the form of address.
Example:
partyid
add1
add2
add3
add4
If add2 is null then add3 comes in add2 line and add4 comes to add3 line.
【Answer】
You can hide a row by checking whether it is empty in a reporting tool. But this will result in records with different lengths. If you need to remove null values and move the next values up to fill up the blank, try SPL (Structured Process Language) for the data source preparation. Only a two-liner script suffices.
A |
|
1 |
=$selectpartyid,add1,add2,add3,add4 from tb |
2 |
=A1.(~ .record( ~ .array().select(~)|[““,””,““,””])) |
Final result:
A1: Retrieve data.
A2: Remove A1’s empty values and move next ones up.
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