Split tOracleRow output to multiple output files

Four Stars

Split tOracleRow output to multiple output files

Hello,

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,

Pavel

Fifteen Stars TRF
Fifteen Stars

Re: Split tOracleRow output to multiple output files

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.


TRF
Four Stars

Re: Split tOracleRow output to multiple output files

Hi TRF,

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?

Regards,

Pavel

What’s New for Talend Spring ’19

Watch the recorded webinar!

Watch Now

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog

How Media Organizations Achieved Success with Data Integration

Learn how media organizations have achieved success with Data Integration

Read

6 Ways to Start Utilizing Machine Learning with Amazon We Services and Talend

Look at6 ways to start utilizing Machine Learning with Amazon We Services and Talend

Blog