Filter a CSV file according to condition and output result as a list
We have a CSV file whose format is “category + detail data”:
Name,Colour
Chair,Blue
Chair,Green
Chair,Yellow
Table,Purple
Table,Pink
Door,Yellow
Task: Use Java to query the file. The input parameter is category and the output result is a detail data list. For example, input Chair and the output is Blue,Green,Yellow.
Here is the SPL code:
=T($[data.csv]).select(Name==?).(Colour)
The T()function parses the CSV file; $[] represents a string.
Read How to Call a SPL Script in Java to find how to integrate SPL into a Java application.
SPL Official Website 👉 https://www.scudata.com
SPL Feedback and Help 👉 https://www.reddit.com/r/esProc_SPL
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