Multi-file Association in Java
【Question】
I want to use 10 CSV files in my Java program. Are there any options to build relations between these individual CSV files? For example if I have a CSV file with postal codes and another one with postal codes and city names, how can I connect them? And what packages/classes I can work with CSV in Java? Thanks for your answers!
【Answer】
It’s easy to get it done with esProc SPL. The SPL script is simple and clear:
A |
|
1 |
=file("D:/sOrder.csv").import@ct(OrderID,SellerId,Amount) |
2 |
=file("D:/emp.csv").import@ct(Eid,Name) |
3 |
>A1.switch(SellerId,A2:Eid) |
4 |
=A1.new(OrderID,SellerId.Eid,SellerId.Name,Amount) |
A1: Import orders data from sOrder.
A2: Import employee data from emp.
A3: Switch A1’s SellerId to A2’s referencing field Eid.
A4: Get the joining result according to the join fields.
An SPL script can be integrated with a Java application via esProc JDBC. See How to Call an SPL Script in Java to learn more about the integration.
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