Multiple "instances" of a report, all going at once?
Posted in 1994
OK, is there a way to do this? (I am pretty sure the answer is "no"). I want my program to write out a number of different output files, all at once, all in the identical format. So I'd like to start several "instances" of a single report, output rows to each of them, then finish each report, then stop. For instance, I might be processing a large number of records, and foreach record I do some calculation that tells me which state it gets credited to. My users want to get a separate report for each state. So I really want to start 50 different instances of my report, send each record to one of them depending on results of said calculation. Now I am pretty sure there is no such thing as an "instance" of a report, but I feel that the should be. I report is just a function, after all. One sort-of-solution is to generate a single output file, ordered first by state, with a "skip to top of page" after group of state. Then I'd have to cut the output file up into pieces, which doesn't seem entirely easy since there is no knowing how long each piece will be. Another solution of course is to define 50 different report functions, rpt_az, rpt_ca, rpt_ny, etc, all identical. This would work, but my soul rebels against it. Actually what I could do is define the report "template" rpt_xx once, then in my makefile have a bunch of "sed"s that would make 50 copies of the report, substituting the various state prefixes for "xx", then compile the whole thing. At least then when I come to tinker with the report layout I'll only have to tinker with the single template. I am pretty sure that there is no better way of doing this, but if anyone can think of one then I'd love to hear it. Paul