Calculating BMI

Hi everyone,    I'm very new here and am trying to make a sportsdashboard between individual sporters and coaches. One of the things that we want to include is the BMI.   Does anyone know how to take two attributes of the same entity (weight and length) and how to put that in a microflow within the formula:  Weight/(length x length)        
3 answers

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. 



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!