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)
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.
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