ConditionalSetTableRowsSum

This function agregates rows from source table to destination table. It groups it by selected column. Use can specify multiple pairs of targetSumField and sourceFieldToSum.

Should only be used in manual rules.

Syntax

ConditionalSetTableRowsSum("targetTable","sourceTable","targetGroupField","sourceGroupField", "targetSumField1", "sourceFieldToSum1", ["targetSumField2", "sourceFieldToSum2"]);

Function arguments

  • targetTable – (String) Target table name.
  • sourceTable – (String) Source table name.
  • targetGroupField – (String) Target table column where will be stored name of group.
  • sourceGroupField – (String) Source table column which will be used to create groups.
  • targetSumField1 – (String) Target table column where will be stored sum of group.
  • sourceFieldToSum1 – (String) Source table column which will be use to calculate group sum.
  • targetSumField2 – (String) [Optional] Second target table column where will be stored sum of group.
  • sourceFieldToSum2 – (String) [Optional] Second source table column which will be use to calculate group sum.

Return value

This function returns String. Return empty string.

Examples

Example 1: This function groups rows from table 'SourcePositionsTable’. Use value from column 'SourceColumnCurrency’ as key of group and calculate sum of column 'SourceColumnAmount’ as value for this group. For each group create a row in table 'TargetCurrencyTable’ and store group key in column 'TargetColumnCurrency’ and value in column 'TargetColumnSum’.

ConditionalSetTableRowsSum("TargetCurrencyTable", "SourcePositionsTable", "TargetColumnCurrency", "SourceColumnCurrency", "TargetColumnSum", "SourceColumnAmount");

Example 2: This function groups rows from table 'Positions’. Use value from column 'VAT’ as key of group and calculate sum of columns 'Netto’, 'Brutto’ and 'Vat value’ as values for this group. For each group create a row in table 'VAT summary’ and store group key in column 'VAT’ and values in columns 'Netto summary’, 'Brutto summary’ and 'Vat summary’.

ConditionalSetTableRowsSum("VAT summary", "Positions", "VAT", "VAT", "Netto summary", "Netto", "Brutto summary", "Brutto","Vat summary","Vat value");
Was this article helpful?
0 out Of 5 Stars
5 Stars 0%
4 Stars 0%
3 Stars 0%
2 Stars 0%
1 Stars 0%
How can we improve this article?
Please submit the reason for your vote so that we can improve the article.