Supress detail band on master-detail with no detail data

I have a report with one master and one detail band. In my dataset there will always be data in the master band but often the objects on detail band will be empty.

The detail band though when it is populated is quite large and as things l stand my report contains lots of empty space. PrintIfDetailEmpty is false on the Detaildata band.

Is there a way of supressing the detail band if there is no data to display?

Comments

  • gpigpi
    edited 2:41PM
    wrote:
    Is there a way of supressing the detail band if there is no data to display?
    DetailData1.Visible := False
  • Thanks gpi

    but that makes the detaildata band invisible irrespective of whether there is data in any of the object on the band.

    I am suprised that this is not the default position for FR, it would seem to make sense that if there is no data to display on a band then it is not displayed.
  • edited 2:41PM
    I'm pretty much sure that there's a good reason for this. I just can't think of any.
  • gpigpi
    edited 2:41PM
    Use band's OnBeforePrint event to hide/show band
  • gpi wrote: »
    Use band's OnBeforePrint event to hide/show band

    Thanks gpi that works - but i should have bene clear clear) rather than my user writing code to check whether fields are empty.
  • edited 2:41PM
    I'm using OnBeforePrint to print DetailData1 if it IS empty:

    procedure DetailData1OnBeforePrint(Sender: TfrxComponent);
    begin
      if DetailData1.RowCount = 0 then
      begin                  
       Engine.ShowBand(DetailData1);
       DetailData1.Visible := True;
       DetailData1.PrintIfDetailEmpty := True;
      end;                 
    end;
    
    begin
    end.
    

    And none of that, separately or together, seems to work. An example would be nice.
    gpi wrote: »
    Use band's OnBeforePrint event to hide/show band
  • It's the opposite :

    Set on the FR Designer the MasterData BAND :

    PrintifDetailIsEmpty : True

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.