Hey Joely,
You can do it as following, in my example i use person as entity:
This result is a variable BMI, i check if the input values are not empty and not zero to protect the code for errors(for example dividing by zero is impossible) the BMI variable you can use to set an attribute with.
Hope this helps
Good luck
Hi Joely,
When saving the entity for the person, you can use the Change activity inside the microflow. Here, set the BMI attribute with a calculation which would look something like this:
round($Person/Weight div ($Person/Length * $Person/Length))
I put the round function in front of the calculation because arithmetic expressions return a decimal.
Documentation: https://docs.mendix.com/refguide7/arithmetic-expressions/
Hi Joely,
In this case I would do the following:
- Create a new attribute in te same entity called BMI
- Pass an object of the entity you are using in a microflow
- In this microflow use a change action where you set BMI to $sporter/weight : ( $sporter/height * $sporter/ height)
- Refresh the object if you want the changes to be shown immediately.
Hope this helps!