One-to-many entity setup help

Hi there,   I have an entity of Customer Data, and for each customer they can have many Statement Data as shown below.   Statement Data is chronological, and I want to have a column which accumulates a balance ‘AudBal’.  E.g.  Row 1 “Debit” = £10          AccumulatedBal = £10 Row 2 “Debit” = £63          AccumulatedBal = £73 Row 3 “Debit” = £5            AccumulatedBal = £78   Could someone show me the microflow setup for how I could achieve this. Thanks
2 answers

Add an attribute AccumulatedBal to Stmt(*1), default value 0. Create a microflow with Data as input parameter. Then in your microflow:

  • first activity: Retrieve Stmt over association from Data.
  • second activity: List sort by creation date; you wil get a SortedStmt-list
  • third activity(*2): Loop over the SortedStmt-list; then in the loop:
    • Change Object; IteratorSortedStmt-list add Debit to AccumulatedBal
  • Pass SortedStmt-list to the end-event

Save this microflow as DS_Stmt_ByData_SortedAndAccumulated.

Now on your page add a Datagrid ( or listview, or datagrid2, whatever spits your needs best) and set this microflow as datasource.

*1: this attribute on Stmt or on Data? on Data it will give you one number only, the current balance. On Stmt it gives you the balance aftershave each statement.

*2: Recalculate every time or only upon saving a new statement. Recalculation is only needed if you have not filled the AccumulatedBal before. Once that attribute is filled for every  stmt, go with an update upon saving each New stst.


Hi Lee, 


Are you planning to have the AccumulatedBal attribute on Data entity?

if So, the easiest way todo is recalculating this value on the Event After Commit / Delete of the Stmt entity. Or calling a MF ACT_Data_RecalcBalance ...


All you have todo is:






Hope this helps

best regards