How to calculate total in cross band

The Cross Band element is a very handy tool for building dynamic tables. But many users are challenged by the absence of the implemented ability to calculate totals for cross bands. Actually, you can solve this task using scripts and it won’t be more difficult than if any special approach for this exists.

To calculate totals it is needed to do the following:

    • In CommonScript of the document, declare a variable where the summing will be performed:

double lineSumm;

    • In GenerateScript of Detail, which includes CrossBand set the counter to zero:

lineSumm = 0; 

    • In GenerateScript of TextBox that represents a column, add summing (where dataBand1[(string)GetData("Data.Columns.Name")] – an expression that is displayed in a cell):

lineSumm += (double)dataBand1[(string)GetData("Data.Columns.Name")];

    • Set binding for Value of TextBox, that is located in the cell for the total to get expression from the lineSumm variable.
You can find a sample here

Add Feedback