User Tools

Site Tools


addtotal_add_a_total_field_to_the_last_level_added_.htm
Navigation:  ABC Library Reference > BreakManagerClass > BreakManagerClass - Methods >====== AddTotal (add a total field to the last Level added) ====== Previous pageReturn to chapter overviewNext page
AddTotal (target, source, type, reset )
(target, source, type, reset, condition)
(target, reset )
(target, reset, condition )

blk2blue.jpg

AddTotal Identify the break total type and optional source/target fields and condition.
target The label of a field that the total result will be stored into.
source The label of a field that the total result will be calculated from.
type A byte that identifies the total type defined for the break. A count type = 1, average type = 2, sum type = 3.
reset A byte that specifies whether or not the target variable is reset on each break detected. A value of 1 specifies a reset, zero will not reset the target value.
condition A valid expression that will force a reset when evaluated to TRUE.

The AddTotal method is an overloaded method that caluculates three types of conditional or unconditional totaling.

Implementation: The AddTotal method is called after each break and level is added, directly following the AddResetField method. In the template interface, it is only active when totaling is added to the break.

Example:

 BreakMgr.Init()

 BreakMgr.AddBreak()

 BreakMgr.AddLevel() !Count Break

 BreakMgr.AddResetField(PEO:Gender)

 BreakMgr.AddTotal(CountValue,1)

 BreakMgr.AddBreak()

 BreakMgr.AddLevel() !SumBreak

 BreakMgr.AddResetField(PEO:Gender)

 BreakMgr.AddTotal(SumValue,SourceToTotal,eBreakTotalSum,1)

 BreakMgr.AddBreak()

 BreakMgr.AddLevel() !ConditionalAverage

 BreakMgr.AddResetField(PEO:Gender)

 BreakMgr.AddTotal(AverageValue,SourceToAverage,eBreakTotalAve,0,'PEO:Gender = M')

addtotal_add_a_total_field_to_the_last_level_added_.htm.txt · Last modified: 2021/04/15 15:56 by 127.0.0.1