Calculations between 2 entities

0
I have a table Material having the UnitCost(Integer) attribute & another table Order having the OrderQuantity(Integer) attr and TotalAmount(Calculated Integer Attr) attr. I want to perform calculation like OrderQuantity * UnitCost and store the value in TotalAmount attr. I have called a microflow but i am not understanding how to get the UnitCost Any ideas how to do so as I am stuck???(I am new to Mendix)
asked
2 answers
3

Hi Ameesha,

in your example, you would have to retrieve (in your microflow) Material from Order "By Association" or - if both have been commited to database already - "From Database". Then you can multiply Material/UnitCost with Order/OrderQuantity.

Please allow me to recommend having a look at the Mendix online learning paths: here you will find great resources to get kickstarted with Mendix:
https://academy.mendix.com/link/path

Regards,

Thorsten

answered
1

Hi Ameesha,

 

You can try calling action ‘Change object’ in your microflow and change your Order’s TotalAmount to take value of this expression:

$OrderObject/Questionnaire.Order_Material/Questionnaire.Material/UnitCost * $OrderObject/OrderQuantity

 

I hope this helps.

 

Regards,

Paulina

answered