| **Navigation:**  [[abc library reference.htm|ABC Library Reference]] > BreakManagerClass > BreakManagerClass - Methods >====== AddTotal (add a total field to the last Level added) ====== | [[addresetfield add a reset field to the last level added .htm|{{btn_prev_n.gif|Previous page}}]][[abc library reference.htm|{{btn_home_n.gif|Return to chapter overview}}]][[construct automatic initialization of the breakmanager object .htm|{{btn_next_n.gif|Next page}}]] | | || | **AddTotal** | **(**//target,// //source//, //type//, //reset //**)** | | | **(**//target, source, type, reset, condition//**)** | | | **(**//target, reset//**// //****)** | | | **(**//target, reset, condition// **)** | {{blk2blue.jpg|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''')**