BMI calculation check
Calculate a subject BMI.
Rule description: Calculate a BMI using the below formula:
BMI = Weight/Height * Height
The result has one decimal place (for example, 25.1). The unit is kg/m2. If weight and height units are provided in pounds (lb) and centimeters or inches (cm or in), convert them into kilograms (kg) and meters (m).
Rule expression
if(hght===0||wght===0){
return 0;}
else{
if(getStringFromChoice(hghtunt)=='cm'){
hght=(hght*0.01);}
else if(getStringFromChoice(hghtunt)=='in'){
hght=(hght*0.0245);}
if(getStringFromChoice(wghtunt)=='lb'){
wght=(wght*0.453);}
return (wght/((hght)*(hght)));}
Definitions
Return value
Verification steps
- Using a subject for testing, go to the given visit and form
containing the items to check, in this example the height value
<
hght
>, height unit <hghtunt
>, weight value <wght
>, and weight unit <wghtunt
>. - Update the form items
hght
,hghtunt
,wght
andwghtunt
as in the following table and verify the result is as listed:hght
hghtunt
wght
wghtunt
Result 175 cm 50 kg 16.3 175 cm 50 lb 7.4 175 cm 78.0 lb 11.5 175 cm 78.0 kg 25.5 72 cm 78.0 kg 150.5 72 in 78.0 kg 23.3 0.0 in 78.0 kg 0
Note:
Repeat the above steps if the form is present in multiple visits.
Parent topic: Electronic Data Collection (EDC) examples