Two master data bands under one group header?

hsmhsm
edited November 2014 in FastReport 4.0
I have a working report that uses a group header, a master data band connected to a dataset and a group footer.
The group header has a condition that breaks on changes in a certain ID in the dataset.
The master data band correctly shows the data grouped by the ID.

Now I want to add a second band of data, positioned after the last master data row of each group is displayed and before the group footer is displayed.
This band will use a different dataset but one that also includes the same ID as that used for the group header.

How can this be done?

ie I have something like this
<--- Group header for id 1
  data a for id 1
  data b for id 1
  data c for id 1
               <---  Group footer for id 1
               <--- Group header for id 2
  data a for id 2
  data b for id 2
  data c for id 2
               <---  Group footer for id 2

etc

and I would like to get
<--- Group header for id 1
  data a for id 1
  data b for id 1
  data c for id 1

  different data p for id 1
  different data q for id 1
  different data r for id 1
  different data s for id 1
               <---  Group footer for id 1
               <--- Group header for id 2
  data a for id 2
  data b for id 2
  data c for id 2

  different data p for id 2
  different data q for id 2
  different data r for id 2
  different data s for id 2
               <---  Group footer for id 2

Comments

  • gordkgordk St.Catherines On. Canada.
    edited 1:32PM
    Try this
    Use a subreport in an unattached child band for the second master
    write code to display the child in the obp event of the group footer.
    engine.showband(childbandname)
  • hsmhsm
    edited 1:32PM
    gordk wrote: »
    Try this
    Use a subreport in an unattached child band for the second master
    write code to display the child in the obp event of the group footer.
    engine.showband(childbandname)

    Thanks gordk,

    That printed the data in the right place but displayed all the data from the second dataset at once after every group in the first dataset, regardless of the group being shown in the main report.

    It didn't seem to matter if the subreport had its own group header or not or, if it did have one, whether the group condition was set to a change in the ID in dataset1 or dataset2 I still got a similar result.

    How can I tell the subreport to only display the data where the ID is the same as that for the group in the main report ?
  • gordkgordk St.Catherines On. Canada.
    edited 1:32PM
    in the oad event of the group header set a variable to the condition value.
    in tht subreport obp event of masterdata set the visible property
    ie masterdata2.visible := dataset."fieldname" := variable name;
  • hsmhsm
    edited 1:32PM
    gordk wrote: »
    in the oad event of the group header set a variable to the condition value.
    in tht subreport obp event of masterdata set the visible property
    ie masterdata2.visible := dataset."fieldname" := variable name;

    Ah, that makes sense. Thanks gordk
  • edited 1:32PM
    gordk wrote: »
    in the oad event of the group header set a variable to the condition value.
    in tht subreport obp event of masterdata set the visible property
    ie masterdata2.visible := dataset."fieldname" := variable name;


    Hi! Can you please help me to write the right code?

    My code looks now like:
    var con: string;                                
    
    procedure GroupFooter2OnBeforePrint(Sender: TfrxComponent);
    begin
      engine.showband(Child1) ;  
      engine.showband(Child2) ;        
    end;
    
    procedure GroupHeader1OnAfterData(Sender: TfrxComponent);
    begin
      con:= GroupHeader1.Condition;    
    end;
    
    procedure MasterData3OnBeforePrint(Sender: TfrxComponent);
    begin
    masterdata3.visible := True;              
    end.
    

    I have a problem with this line:
    ie masterdata2.visible := dataset."fieldname" := variable name;
    

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.