Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Parsing and storing with commit and rollback components.

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

Labels (2)
2 Replies
TRF
Champion II
Champion II

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.

Anonymous
Not applicable
Author

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.

 


M_error.PNG