Suppose Net (Premium-Commission)
formula field name is {@Net}
. Now you have to create another three formula fields.
- Initializer: this formula filed will be placed in header section to reset all variables.
- Increment: this formula field will be placed in detail section to summarize the value.
- Total: this formula field will be placed in footer section to show total of
{@Net}
.
Code will be writen in formula fields as below.
{@Initializer}
WhilePrintingRecords;
Numbervar dSum :=0;
{@Increment}
WhilePrintingRecords;
Numbervar dSum; //Don't initialize zero
dSum:=dSum+{@Net}; //{@Net} formula field must be return numeric value
{@Total}
WhilePrintingRecords;
Numbervar dSum; //Don't initialize zero
dSum;
Place all formula fields in their appropriate section and suppress {@Initializer}
and {@Increment}
formula field.