Issue
As an individual, I need to sum up the numbers in the "Summa" column of a table and display the result in a label field. Can someone help me to achieve this task? A screenshot example is attached for reference.
Resolution
To accomplish the task, you need to sum the numbers in the "Summa" column in the table and display the result in the Label ("Sum1") field.
You can do this by adding a JavaScript code to the Text property of the Label widget. The code uses the forEach method to loop through each element in the Table1 tableData array. Inside the loop, it adds the value of the Summa property of each element to a variable called sum. Finally, it returns the sum value.
The code in JavaScript looks like the following:
(function() {
let sum = 0;
Table1.tableData.forEach(element => {
sum += element.Summa;
});
return sum;
})()
Once you add the code to the Text property of the Label widget, it will display the sum of the numbers in the "Summa" column of the table.