Order total is doubled

Greetings I am developing an app to make a car sale and I want to show the total of the sale after having selected several cars. For this I use this microflow:   Which I call from the field calculated from the data model as follows: And when called from a reference selector, it displays the duplicate result: Why does this happen and how can I fix it? Thank you for your help.
1 answers

Hi Reina,


You are placing the attribute FinalTotalPrice in the Product entity. That means that for every product you create it is calculating the total price. In your screenshot I see 2 products. That's why there are 2 options to select. Try adding a third product. The dropdown then will show you 3 options, all with the same total ;)


The solution to your problem is a view entity. This view entity has an attribute ‘FinalTotalPrice’ and a association to the Product entity. The ‘FinalTotalPrice’ is calculated by adding the prices of all retrieved products. On the page you can show the products in a list and the total price in a textlabel.

Your Domain model should look a bit like this:

and your microflow prior to the page a bit like this:


Hope this helps!