Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
I am using positional parser. It iterates through the file and produces valid and invalid inputs.
If any data passes the validation the job starts storing into database. But i want to wait till entire file has processed. If every line passes validation then only start saving to database and commit else revert back the changes.
Thanks,
Shashi
Hi,
As a simple solution, replace the tPostgresqlOutput component by a tHashOutput or tFileOutputDelimited.
On subjob OK connect to your tFileInputDelimited, add a dummy tJava connected to a tHashInput (referencing the previous tHashOutput) with an "If" connector with the following condition:
(Integer)globalMap.get("tHashOutput_1_Nb_Line") != null && (Integer)globalMap.get("tHashOutput_1_Nb_Line") > 0
If you use a tFileOutputDelimited instead of a tHashOutput, replace the dummy tJava by a tFileRowCount.
At the end, depending on the result condition, get the input and go to the database (or not).
Hope this helps.
Hello TRF,
Instead of using file output , i am using using javaflex. In invalid output, i am setting context variable and checking it on "IF" condition. Now condition is working fine. But i am unable to send main data output to the SqlOutput. After if condition of javaflex i am getting only one row rather than entire parsed data.