Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

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)

Labels (1)
2 Replies
nfz11
Creator III
Creator III

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.

Anonymous
Not applicable
Author

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.