1
votes

I have a report that should have the following structure:

Group A.1
  Header 1
    Record Q.1
    Record Q.2
  Header 2
    Record P.1
Group A.2
  Header 1
    Record Q.3
  Header 2
    Record P.2
    Record P.3
....

However, wat I consistently get is this:

Group A.1
  Header 1
    Record Q.1
  Header 1
    Record Q.2
  Header 2
    Record P.1
Group A.2
  Header 1
    Record Q.3
  Header 2
    Record P.2
  Header 2
    Record P.3
....

My data is coming from two datasets that are linked together on the group key (A). I tried with two sub reports in the details section of the group. The sub report is rendered for each record (Q.1 and Q.2), which makes sense. However, I'd like to suppress the header for each record except the first. I can't seem to figure out how to accomplish this.

I tried without sub reports but I don't know how to determine inside the details section whether I'm at the first record (Q.1) or the second (Q.2).

I also tried creating two additional adjacent sub groups instead of nested groups but that does not seem to be possible at all. I can only keep nesting sub groups, not placing subgroups next to eachother.

My data is structured as follows (from an Oracle database):

Dataset 1                        Dataset 2
Group A.1 | Record Q.1           Group A.1 | Record P.1
Group A.1 | Record Q.2           Group A.2 | Record P.2
Group A.2 | Record Q.3           Group A.2 | Record P.3
2

2 Answers

1
votes

You can add a parameter to the subreport called something like suppresshead, you can then link this to a running total field incrementing for each record resetting on change of the group field.

1
votes

I'm not sure if this will work or not due to the evaluation time of subreports, but you can give it a whirl: Try using a shared variable as a switch to determine whether you should be suppressing the subreport header or not.

For example, in the header of your subreports you could have a formula that checks to see if the last subreport group value is the same as the current one; if it is, then suppress the header.

//initialize the shared variable in header of main report
whileprintingrecords;
shared stringvar lastSubVal := "";

//in the suppression formula for the subreport header, check the variable
//  to see if the last subreport header is the same as the current one (and suppress if true)
whileprintingrecords;
shared stringvar lastSubVal;

{table.currentGroupValue} = lastSubVal

//finally, in the subreport footer, just update lastSubVal
whileprintingrecords;
shared stringvar lastSubVal := {table.currentGroupValue}