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

wght

Corresponds to Weight from rule description.

hght

Corresponds to Height from the rule description.

hghtunt

Corresponds to Height unit from the rule description.

wghtunt

Corresponds to Weight unit from the rule description.

Return value

Number

Returns a calculated numerical value rounded according to the target item format. In this case one decimal place, for example 21.5.

Verification steps

  1. 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>.
  2. Update the form items hght, hghtunt, wght and wghtunt 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.