I have a workflow that takes output containing customer data, sorts it (via a router transformation) according to the system in which the customer is found, and generates flat files for each system. It also generates header and trailer files for each system, and I combine the header, detail and trailer files via a post-session command.
The problem is that there's a requirement for me to generate "empty" system files where there are no records - i.e just a header and trailer with nothing between. But because the header and trailer files are being generated via the router, for systems with no records I get no output at all - not even the header or trailer. (I have to generate at least the header via the router as it contains the system name.)
I can't think of a way to separate out the header and trailer from the router and still get accurate data for the system and the row count for the trailer. Ideas?
Ended up assigning the row count in the detail files to a variable, then generating headers and trailers in a subsequent flow. This way the header/trailer files are always generated, and since the variable has an initial value of 0 it's still accurate if there are no detail rows.