Home General
New Blog Posts: Merging Reports - Part 1 and Part 2

Sum fields in label before group break

Hallo all,
I have to print report who have fields to sum before break.
I have add a variable to sum the fields and it works. I have insert showmessage in OnCalc (Value := Value + DBTable['my_table_name'];) to control, and the number is increased.
Then I have used in Groups[0], the AfterGroupBreak to clear the Variable1.Value ( := 0) and, when the break occour, it is cleared.

But I'm not able to find the right procedure to set the label (Text or Caption) the number set in Variable1.Value before the break.
I have tryed to write it when I add the Field value to Variable1.Value in OnCalc, but only the first time is stored, and when I try to show it, I see only the value set in first field.
Can anybody help me?

Thanks in advance,
Sergio

Comments

  • For a simple sum, I recommend using a DBCalc. Variables are useful for more complex calculations.

    Do not use the AfterGroupBreak to reset a value, use the ResetType or ResetGroup properties (Variable/DBcalc).

    I suggest spending some time with our tutorials and demos to get a better understanding how calculations are handled in ReportBuilder. Demos 14 - 19 show how to use DBCalcs and Variables in conjunction with groups to keep running totals etc.
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • Thanks Nicocizik for quicly answer.
    I have use the DBCalc for fields sum, but at the end I'not undestand how get value of sum by DBCalc!!
  • edited November 2023
    No, I have use TEXT and it works, but the problem persist. I have some fields and I do not understand how set the label before the break group. I have try with BeforeGroupBreak, but it is execute at the start.
    I whant to execute the filling of the label, immediately BEFORE the AfterGroupBreak, when the DBCalc have make the sum of the last field of group.
  • Hi Sergio,

    Did you look at the demos I mentioned? These demos show exactly how to use DBCalc and Variable components in this way.

    Also, please work through the "Groups, Calculations, and the Summary Band" tutorial to get a better idea how to make calculations work in your reports.
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
Sign In or Register to comment.