Footer for MasterDataBand having two Detailbands

edited 12:29PM in FastReport 3.0
Hello,
I have a report (bill-calculation) with a MasterData-Band, which
has two DetailData-Bands, e.g:

MasterData: agios and disagios
DetailData1: agios
+ 100,00 $
+ 200,00 $
DetailData2: disagios
- 100,00 $
- 50,00 $

Now I want to print a footer that shows the sum of all values (agios+disagios):
"Sum 150,00$"

If I add a footer it is always assigned to the band before the footer,
in this case DetailData2. If DetailData2 is empty and only DetailData1
has data then the footer is not printed and I have no sum-row.
Therefore I need a footer for the MasterData, which
is printed below DetailData2.
How can I do that ?

Thanks

Comments

  • edited 12:29PM
    Use Engine.ShowBand(Footer) in script code.

    DetailData1OnAfterPrint:
    if DetailData2.DataSet.Count = 0 then
    Engine.ShowBand(Footer)
  • edited 12:29PM
    Thank you for your fast answer.

    I hoped to solve it without a script because scripting is difficult
    to explain to our customers, who want to change reports.
    (All in all FastReport is easy to use.)

    Maybe you can think about the following proposals for one of the next versions:

    1. The footer could get an additional property for setting the parent to which
    it belongs (footer.Parent=MasterData) .

    2. Now, a child-band is printed directly after the parent-band even if there are
    detailbands in between. E.g the report
    MasterData
    DetailData1
    DetailData2
    Child (for MasterData)
    is printed as
    MasterData
    Child (for MasterData)
    DetailData1
    DetailData2
    I solution for my problem could be, if the order of the bands would be kept.
  • edited 12:29PM
    Did you try set DetailData.PrintIfDetailEnpty to true ?
  • edited 12:29PM
    DetailData2 has also a header with the caption "Disagios".
    If DetailData2.PrintIfDetailEmpty is set to true then the header is printed too
    although there are no disagios. If there is no header then it would be ok.

    I found a another way, but not an elegant one:

    Header : "Agios and Disagios"
    MasterData1: agios-disagios-dataset (recordcount is always 0 or 1 - having or not having)
    Header : "Agios"
    DetailData1: agios-dataset
    + 100,00 $
    + 200,00 $
    Header : "Disagios"
    DetailData2: disagios-dataset
    - 100,00 $
    - 50,00 $
    MasterData2: agios-disagios-dataset (same es MasterData1) : "Sum of ... [Sum]"

    It seems to work, but it is difficult to explain to customers.

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.