printing footer of an empty detail band

edited 10:32AM in FastReport 4.0
Hi,

I have a (master/detail) report that is supposed to print data of the master band and all records of its detail band, the latter has a footer containing some static text that should be printed regardless the detail band is empty or not

I tried the following code but no chance to get it running,
var
ds: TfrxDataSet;

begin
ds := Report.GetDataset('clearanceDs');// this is the name set in username property
if ds.recordcount = 0 then
begin
engine.showband(clearanceFtr); // this is the name of the footer that should appear at the bottom of each detail even for empty ones
end;
end.

the above code is located at the beginning of the page code.
please advise,


Regards,
Raouf

Comments

  • edited 10:32AM
    As I can see this code that you've shown is MasterBandOnBeforePrint event.
    Try such a solution:

    1. Add ChildBand to MasterBand and make it not Visible, and put your static text over there
    2. If ds.recordcount is 0 then set this ChildBand.Visible := true and your static text will be printed naturally
    3. If ds.recordcount is NOT 0 then set this ChildBand.Visible := false and print the static text from other bands

    Pay attention to set MasterBand.PrintIfDetailEmpty := true.

    Mick

  • edited February 2011
    Mick.pl wrote: »
    As I can see this code that you've shown is MasterBandOnBeforePrint event.
    Try such a solution:

    1. Add ChildBand to MasterBand and make it not Visible, and put your static text over there
    2. If ds.recordcount is 0 then set this ChildBand.Visible := true and your static text will be printed naturally
    3. If ds.recordcount is NOT 0 then set this ChildBand.Visible := false and print the static text from other bands

    Pay attention to set MasterBand.PrintIfDetailEmpty := true.

    Mick

    thanks Mick,

    I'll give it a try tonight as I am still at work right now, will post my comment regarding your solution very soon.

    Regards,
    Raul

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.