Templates Plugins Courses

Mathjs plugin - "Evaluate Expression" contains input values & calculated values

After much agony I found your plugin which solves my expression problem, thank you. Beginner level Bubble skill here.

I got this expression working on your test page:

(((Expression SumOfFolds’s value-40)/20((Input Weight’s value^0.425)(Input Heights’s value^0.725)71.84/10000)0.739/Input Weight’s value-0.003)^0.50.7)*

Basically it is a body fat calculator.
It takes the following input values from an input form:

  1. 10 body site measurements are captured and sum’d into a total (Expression SumOfFolds)
  2. Weight (Input Weight’s value) and Height (Input Height’s value) are then added to the expression to calculate the body fat number (eventually should be shown as a %)

2 questions for help:

  1. How would I set this up on the input form without using your method of an input text field containing the expression?
  2. I have 8 different “formulas” to calculate body fat and I like to store them in the data base and then select which one/method I need to use to perform the body fat calculation. Is this possible?
    Also, all the input are taken with 1 decimal place place I need to round the answer from the expression off to 4 decimals. How do I do that?

Any help will be much appreciate and thanks again. Best $20 I’ve spent this week.

Hi @grantskinner,
Thank you for reaching out, and for your purchase. :pray:
We highly appreciate you using our plugins.

I hope I understand the idea of your app and my suggestions will be useful for you. Since you are getting values from some inputs that users will insert according to their body properties.
You can use a dropdown menu that will contain Option 1 till Option 8 (for 8 formulas to calculate body fat)

Once you select one option from the dropdown menu, set a custom state for the page where the value will be equal to the input text field expression (these inputs can be hidden on your page but you can still refer to them).
After the custom state is set you can evaluate the expression and get the result of the calculation according to the formula selected from the dropdown menu.

There might be other ways of doing this if your users have to register to your app and insert their parameters inside their profile. Then you can make changes to the Current User and use their data in your formulas to evaluate the expression.

Hope the above will be useful to you and will guide you in the right direction. :slightly_smiling_face:
In case there will be any other plugin-related questions, please don’t hesitate to contact us, will be glad to help.
Best regards,