Run If for tReplace and tFileOutputMSPositional

Four Stars

Run If for tReplace and tFileOutputMSPositional

I have a multi-scheme positional file.
Consists of the following:
1 - Header line (BH)
2 - Multiple detail lines (PS)
3 - One Footer line (BT)
These files i get from multiple sources, indication is in name of file from where it comes from. Example : PS123000.txt where the '123' is the location indicator.
As i get a file with tFileList i iterate thru a tFileInputMSPositional to use the different schemes.
The header line will 99% of time be just a copy of input file line.
The Detail line will differ and on this line i want to use tReplace to change certain data. Here i use a tReplace and a tFileOutputMSPositional.
The footer line will 99% of time be just a copy of input file line.
This works but the problem i have is the following:
I want to use different streams of tReplace and a tFileOutputMSPositional depending on the location indicator because different changes must be made to the data on the detail lines.
Have tried tJava with 'Run If' but that cannot connect to the tReplace component.
The whole stream above will always run on one file at a time but i want to use it for multiple locations depending on the location indicator.
Anybody have an idea? (if you could understand what i'm trying to do)

Nine Stars

Re: Run If for tReplace and tFileOutputMSPositional

You can use a tMap and choose which output to use based on the file id.  Each output can route to a different tReplace and database component.  You can have as many outputs as you want from a tMap.

 

If you have a very large number of outputs, or outputs you are not sure about at compile time, you could use variables and just one flow.  You could create variables in the globalMap based on the file id which defines your replace rule and database logic and use them in the tReplace logic and database component logic.  This way you would have only one flow.  This also assumes that your tReplace logic can be expressed in a relatively simple way.

--
Please give Kudos and mark topics as solved where appropriate.
Four Stars

Re: Run If for tReplace and tFileOutputMSPositional

Hi,
I did do it via the tMap process but as you said, with too many outputs it
becomes a bit messy. The whole schema have to be duplicated for every
output.

Will have to look into how to do it with one output and variables, doing a
different tReplace depending on the input.

Thanks for help.

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