Joined: 05 Dec 2006 Posts: 158 Location: Seattle, WA
This one is a doozy .
My boss wants me to write a "dynamic" report program that can produce any myriad of reports based on card control and header table data. The control card specifies the report type; the database table the row headings for that particular report. The rest of the criteria is:
1. In a cursor, read all the rows from a table that meets given specifications. The is 158 columns of indeterminate number of rows. These rows have data definitions of alphanumeric, S9 comp, S9 comp-3.
2. (Maybe not simultaneously) In a second cursor, get the report fields, headings and row layout. The number of columns and column headings are derived from this table.
3. Create the report as specified by the second cursor. The report can be as few as 1 column up to the full 158 columns. Prior to reading the second cursor, there is no way to know what report is to be generated, so there can be no fixed report layout.
4. The data in the report is to be displayed in a readable output, so the COMP and COMP-3 fields are to be displayed in their translated format so users can read them. Basically, he wants the report to resemble a SPUFI report separated by semicolons.
How do you do this???? I understand and can do everything but producing the report lines. If you concatenate the row data, how do you keep the semicolons aligned? Any help would be greatly appreciated!
I swear this is a real live project (although I think my boss just wants to see if I can do it).
Joined: 06 Jun 2008 Posts: 8410 Location: Dubuque, Iowa, USA
Reference modification -- define a report line and move in the needed data by columns. You'll need to move COMP and COMP-3 variables to a numeric edited variable before moving to the output line.
Many employers back, I did something similar. The row names and column titles were parameterized as were how to lay out the data on the report line. It took a while to get the output right, but once we did I demonstrated to my boss how we could completely change the layout of the report just by changing the parameters. He was quite happy with it.