When working with subtable views it is a typical requirement to loop over all rows of this subtable view, check a condition in a respective row (e.g. if a specific entry from a list was chosen) and depending on this check change or add up values in this row. In this example we assume there is a column account with a picklist in the subtable view assignment. For all rows in which account 4400 is chosen from the selection list, the sum of the column netamount should be calculated and written into the decimal field decimalSum4400. The function should be executed every time a value in column account or netamount is changed. For this create the following function:
The created function can be called up using the jr_loop_table method. Now add the following call as an OnChange event to the columns account and netamount: jr_loop_table(„assignment“, sum4400);
The loop method calls up your function per each row to check if account 4400 was picked. If so, the value from the column nettoamount is added to the variable sum. This variable is defined outside the function sum4400, since it is a global variable that has to have the same value for each function call up.