my workflow is as follows. I have an input text file with just one column (rows contain some number as customer IDs). For each ID I need to execute a prepared statement and output of this statement should be saved into a separate file named customer_id_some_fixed_text.txt.
My "train" is tFileInputDelimited => tJavaRow => tOracleRow => tParseRecordset => tFileOutput[whatever] (output format is not that important).
In the tJavaRow (besides the generated code) I'm just setting a context variable
context.vCurCustId = input_row.CUST_ID;
tOracleRow is executing a simple statement like
"select * from my_customers where customer_id = ?"
parameters and everything else is set correctly and here I would like to create an output file named context.vCurCustId + "some_other_text.txt".
The problem is that the entire output (for all customer_ids) goes into one file and I have no idea what I'm missing.
Any suggestions would be highly appreciated.
Thanks a lot,
You cannot change the output filename during the flow execution.
So, you have to introduction a tFlowToIterate + a tIterateToFlow.
As you'l have a new flow for each record, now you can change the filename.
thank you very much for your response, however I must admit that I have absolutely no experience with these two controls. Please, could you be a bit more specific where exactly I am supposed to place them and how to set them up properly?
Talend named a Leader.
Kickstart your first data integration and ETL projects.
Watch the recorded webinar!
Part 2 of a series on Context Variables
Learn how to do cool things with Context Variables
Find out how to migrate from one database to another using the Dynamic schema