Sum of decimals based on 2 values

0
Hello Everyone, im working on an app where i can register if i lend people money. so i got an entity with users and an entity with the amount lend. using associations to bind who lend money to who. the problem im facing is that i want an overview of who owes who how much. like if harry owes peter one time 10 euros and a second time 20 euros that i get to see that harry owes peter 30 euros. but i want this for every possibility how would i do this mendix ?
asked
1 answers
0

Create 2 grids on the page of the user that display the amounts over the association then you have a list of money lend to and from. On the grids set the aggregation from the amount column to see the total amount lend or owed. Then with filtering on the user in the grids the total amount lend from and to can be displayed.

As there can be many records this can’t be solved with fields but needs to be solved with a grid or list. What you could also do is create a third entity in which you aggregate the amounts per person. So that when a record is created in the Money_lend entity this will lead to a record in the totals entity (from a microflow) and link this to the user where the money is lend from and to. Then in the microflow first find if a record for the person combination exists, if not create, if so update. If money is lend to update with a negative value, if the money is lend update with a positive value or the other way around. The add a grid for the totals on the user page displaying the totals over the association.

answered