Hi!
I have one table in which I display groups with values and for each group I display one row with the sum of the values (in my example the yellow highlighted rows).
Now, I would like to know how it is possible, how I can display one row at the end of the table, in which I get and show the sum of all groups for each column?
This is my status quo:
Group 1 Line 1 10
Group 1 Line 2 15
Group 1 Sum 25
Group 2 Line 1 55
Group 2 Line 2 10
Group 2 Sum 65
Sum of Groups 90 (How can I realize this Line?)
Sum_Test.zip (398.6 KB)
Kind regards
Malcolm
@Malcolm84
Please check the Sum examples of Managers and Contracts from here:
You can also use variables to sum the desired result and display it at the end of tables. Please check the total
variable from here:
For your document, the template will be as shown below:
<<var [total = 0.0m]>>
<<var [total = total +o.Unterkonten.Sum(p => p.Saldo)]>>
<<[total]>>
@tahir.manzoor
Hello and thank you for your answer!
I create for each column one variable, add the values and display the sum value in each column at the end of the table! Perfect!
But is there a way to put the variables at a different position, because I create the variables in the cell where the foreach-loop starts and this is very confusing. I hope that this can be arranged a little bit better!?
Here is my edited word-template:
Gruppierte_Tabellen_ReportSyntax.docx (23.8 KB)
Kind regards
Malcolm
@Malcolm84
You can put the variable at different position. However, the variable should be used as shared in my previous post.
Have your problem solved or you still facing issue? Please share some more detail of your issue.
@tahir.manzoor
My initial problem with the sum for each column is solved!
I declared the variables before the foreach-loop and add the values to the variable in the foreach-loop. In the last line of the table I display the specific variables!
The only optical problem is, where I can put the variable declarations? The cell in the first column, where I start the foreach-loop and declare the 5 variables is very confusing. Where would you put the variable declarations for a better overview?
For test reasons I put the variable in a textfield, but that doesn’t work.
Thank you for your answers and your help!
Kind regards
Malcolm
@Malcolm84
You can declare the variables before table or foreach loop. You can use these variable as you use in normal C# code. The detail of declaring the variable is well explained here: