How to make a list from Association

0
Good Afternoon Mendix users and experts,  I have an entity called Order, another Entity called Services, Services has 1 attribue called Price, so when I generate an order the price will automatically be taken from the Services through Order_Services association. Now i want to calculate the TotalPrice of all orders I just made, but I cannot use aggregate List or Loop cause it is not allowed to make a list of total Prices because attribute Price is not an actual attribute of entity Order. I would like some help. Thank you very much and have a good day    
asked
2 answers
1

Do the calculation in a microflow and feed the result to the list. Now the list will allow aggregation.

Please note that associating the Service to the Order, has the disadvantage that you can no longer change Service.Price once one Order has been placed since your Order's customer would not like that. Once an order is placed, the price is fixed. Solution to this problem is storing the price as an attribute in the Order.

answered
0

If you know how to identify “all orders I just made”, you can use OQL to calculate total across services and orders. However, from application design standpoint you should follow Tim’s suggestion and put total price of an order into the order entity.

answered