AddTotal (add a total field to the last Level added)

Top  Previous  Next

 

AddTotal

(target, source, type, reset )

 

(target, source, type, reset, condition)

 

(target, reset )

 

(target, reset, condition )

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''')