[resolved] Add rows to an existing data flow, up to a fixed number

[resolved] Add rows to an existing data flow, up to a fixed number

I have a job where the requirement is to create the same number of files each run, adding dummy files if there are fewer than the maximum number of rows.
My schema is very simple - one String column, which can be set to empty string for the dummy rows.
I see tRowGenerator, but I don't see how to use it add to an existing flow.
So right now I have
tPostgresInput -> tIterate ->
I want to add something after tPostgresInput that will cause tIterate to always happen 6 times (the query will always generate 6 or fewer rowss). (I can know I can change the SQL in postgress to do this but I'm hoping to find something that keeps the logic more in talendComponents).

Accepted Solutions

Re: [resolved] Add rows to an existing data flow, up to a fixed number

Start with a tFixedFlowInput that has a list of ALL files, with this as the main flow connect to a tMap with your current file names as a lookup (make sure the join is not configured as an inner join). This should give you a flow that will contain a row for every file defined in the tFixedFlowInput-- which you can then use to iterate over to create your files.
edit:
for a more maintainable solution you can do the same with a DB table or delimited file that defines all expected files rather than a fixedFlow. This is more maintainable because you would need to edit the job to adjust your file list if you use a fixedFlow.

All Replies

Re: [resolved] Add rows to an existing data flow, up to a fixed number

Start with a tFixedFlowInput that has a list of ALL files, with this as the main flow connect to a tMap with your current file names as a lookup (make sure the join is not configured as an inner join). This should give you a flow that will contain a row for every file defined in the tFixedFlowInput-- which you can then use to iterate over to create your files.
edit:
for a more maintainable solution you can do the same with a DB table or delimited file that defines all expected files rather than a fixedFlow. This is more maintainable because you would need to edit the job to adjust your file list if you use a fixedFlow.

Re: [resolved] Add rows to an existing data flow, up to a fixed number

Thank you. That's exactly what I was looking for, I've updated my job using your suggestion and it works.