Please enable JavaScript to view this site.

Process Designer

Navigation: Javascript API > User dialog functions > Subtable view functions > Data > Read values

jr_sum_subtable_column(string subtableViewName, string columnName, string thousandsSeparator, string decimalSeparator, int decimalPlaces, string sumField)

Scroll Prev Top Next More

The function calculates a total for one column in the subtable view. It can be used only for columns that support automatic calculation of a sum. Currently these are DECIMAL, POS_AMOUNT and TEXTBOX subtable view elements.

Parameter

Type

Description

subtableViewName

string

Subtable view name

columnName

string

Column name

thousandsSeparator

string

Optional: Define a thousands separator

decimalSeparator

string

Optional: Define a decimal separator

decimalPlaces

int

Optional: Define the number of decimal places

sumField

string

Optional: Total field name

The return value of this function is the total of one column in decimal figure.
Additionally, the result is displayed in the total field of the subtable, if this is configured accordingly.

Note: Unnecessary zeroes of decimal places will not be displayed in JavaScript.

For TEXTBOX- (validated as decimal figures) and DECIMAL-elements the format is automatically retrieved from the JobRouter settings.

With the optional parameters thousandsSeparator, decimalSeparator, and decimalPlaces accumulation settings can be overwritten. If decimalPlaces was not specified, the number of decimal places from the subtable elements will be used. For TEXTBOX form elements without validation, it is mandatory to specify all three parameters to be able to accumulate the values.

If the optional parameters thousandsSeparator and decimalSeparator are not passed when the function is called, the separators from the user settings are used for a DECIMAL dialogue element. For a TEXTBOX dialogue element, the separators from the general JobRouter settings are used.

Note: The parameters thousandsSeparator and decimalSeparator define the format for reading the values on row level. The paramater decimalPlaces is only used for the output. The return value of the function has the JavaScript type number.

With the optional parameter sumField the result can be returned to a form element. Thereby, the total is formatted on the basis of the transferred parameter.

Please note: If you overwrite one of the fields to be totaled with jr_set_subtable_value, the accumulation is not automatically executed. To do this, you must execute this function again. If the function receives more than two parameters, then the parameter "decimalPlaces" must always be specified. If the function is called with an invalid value for the parameter "thousandsSeparator" or "decimalSeparator", a corresponding error message is displayed. For this the parameters "thousandsSeparator" and "decimalSeparator" should not be identical.