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

Sixteen Stars TRF
Sixteen 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

2019 GARNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Best Practices for Using Context Variables with Talend – Part 2

Part 2 of a series on Context Variables

Blog

Best Practices for Using Context Variables with Talend – Part 1

Learn how to do cool things with Context Variables

Blog

Migrate Data from one Database to another with one Job using the Dynamic Schema

Find out how to migrate from one database to another using the Dynamic schema

Blog