calculating an attribute by multiplying 2 attributes

so, i have got OrderLine, which has the attributes TotalPrice, amount and Price. I want totalPrice to be calculated automatic, by multiplying price by the amount. I suppose you need a microflow to do this, but how do i do that? thanks in advance
2 answers

Easy enough:

Just assign the microflow to the calculated attribute and multiply the 2 attributes in the end event.


One note: calculated attributes have a negative impact on performance in entities with a large number of objects. You may want to consider populating your total price field with an on change microflow on your price and amount input fields or as an event handler on your entity, whichever is more appropriate for your app. It seems like OrderLine entity may have a lot of objects in it at some point in your app lifecycle. If so, each time you retrieve a list of OrderLine objects, the total price will be recalculated for each object when using a calculated attribute.