• Resolved ianwkamiya

    (@ianwkamiya)


    Hello everyone!

    I’m developing a BMR Calculator but I’m not a programmer and have little knowledge about coding so I’m beating myself to make this work.
    Here is the screenshoot of my form:

    Screenshoot

    There is 4 variables: sex, height, weight, age.
    With these info the calculator should be able to make an automatic result of the Basal Metabolic Rate of the user.
    When I preview the form, if I choose “feminine” it says true in the result and show no number even when I correctly input every information, if I choose “masculine” nothing shows up.

    Just to help more: fieldname3 = sex, fieldname4 = height, fieldname5 = weight, fieldname6 = age.

    If anyone could help me I would be really thankful … I’m pretty sure it’s simple but I’m trying to solve this without success in the last 2 days.

Viewing 1 replies (of 1 total)
  • Plugin Author codepeople

    (@codepeople)

    Hello @ianwkamiya

    You are not using the “IF” operation in the correct way. The “IF” operation requires three parameters, and its structure is:

    
    IF(condition, the code when condition is true, the code when condition is false)
    

    Furthermore, the structure of the PREC operation is incorrect too. PREC operation requires two parameters: PREC(X,Y) returns the number X rounded to Y decimal places.

    So, the equation should be:

    
    PREC(IF(fieldname3=='Feminino', 655+9.6*fieldname5+1.8*fieldname4-4.7*fieldname6, 66+13.8*fieldname5+5*fieldname4-6.8*fieldname6), 2)
    

    Please, visit the following link to read the documentation of the operations:
    https://cff.dwbooster.com/documentation#modules

    Best regards.

Viewing 1 replies (of 1 total)
  • The topic ‘Creating a BMR Calculator’ is closed to new replies.