Home General
New Blog Posts: Merging Reports - Part 1 and Part 2

Looking for input

edited May 2002 in General
I have a report that is strange and am looking for some input as to how
others would do it. I essentially need a grid, with an undefined number of
rows and colums, with a column appended to the end for a calculated value
which is not data dependant. Let me give an example.

Say Table1 stores an id, with the user determining how many id's are setup
in table1. For my example, we will say that there are 4 values
(1111,2222,3333,4444). Table2 is again a lookup table which stores a
secondary characteristic, and is again determined by what the user has
entered. For this example, I will say colors and values (Blue, Green , Red).
The last column is based on a boolean conditional that is stored in table1.

Now the report needs to be driven by table3, where all records in table 3
must be linked to both table1 and table2. What I want is a count of detail
records which apply to the appropriate 'cell'. The last column is a count
based on the conditional flag, regardless of relation to table 2.

So, saying there are 10 records in table3
ID Color Flag
---- ------- -----
-
1111 Blue True
1111 Red False
1111 Blue False
2222 Green False
2222 Red False
2222 Green True
3333 Blue
False
4444 Red True
4444 Blue
False
4444 Green True

My report would look like

Blue Red
Green Flag
----- ----
------ ----
1111 2 1
0 1
2222 0 1
2 1
3333 1 0
0 0
4444 1 1
1 2

Sub Total: 4 3
3

Total:
10 4


Kinda long, but wanted to explain myself correctly.

--
Chris Yoder
Programmer
Stven J. Baum, P.C.

Comments

  • edited May 2002
    Chris,
    This is how I created your report.
    I created a group by the ID.
    I added 4 Variable components to the group header. For each variable's
    OnCalc event I did something like the following.
    if FieldByName['Color'].asString = 'Red' then Value := Value + 1;
    ...the same for blue, green and the flag (changing the value it is equal to
    of course)

    I then set the variable's timing to reset on the end of the group.

    I created one more group and had it break on a Label component in the
    report. Then into the footer of that group I copied the same 4 variables
    and OnCalc events and set their timing to be on the traversal of the report.
    Hope this helps you.

    Bill Gage

  • edited May 2002
    Chris,
    You can also do something with very similar results with a Cross Tab report.

    Bill Gage

  • edited May 2002
    Bill, thanks for your input. The problem becomes, how do you create, format,
    and place the variables in the header when number of columns is dynamic? I'd
    assume I could create the variables, lables, and such in code, just as any
    other component can be dynamically created, but can the component then be
    placed correctly in the band and formatted in code?

    --
    Chris Yoder
    Programmer
    Stven J. Baum, P.C.
This discussion has been closed.