Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

[AEM Gems Webinar] Accelerating Experience Manager as a Cloud Service development with Rapid Development Environments

Division by zero


Not applicable
I am trying to calculate a BMI with weight and height fields

the formula is weight / height (m) squared

Right now people will input weight in Kg and Height in cm

Then I have created a new field which will convert the height into meters and then square it. This reads

(Height/100) * (Height/100)

Then I tried using an "if" because without it I get an error suggesting division by zero.

So I tried

if (x <>0) then Weight/x

When I do this I get an error suggesting a syntex error involving x

Please help.

I am new to this so even if you can create the code for the BMI calculation so I can copy it that would be great


1 Reply


Not applicable
Kelly, initially, I would suggest you have your weight and height measurements in the same type of units (kg or cm) and write your code when you square it as (Height * Height). Your code of x<>0 seems as though it would generate an error as the program would read it as less than and great than 0. Sometimes you get errors that say one thing but the snytax is missing a parenthesis or a quotation mark, so I would go back over your syntax. Hope this helps.