Calorie calculator

How to calculate the calorie based on user information that is Height, Weight, Gender, Age, Goal weight?
I got the following formula:
For men: 66.5 + 13.8 x (body weight in kilograms) + 5 x (body height in cm) divided by 6.8 x age
For women: 655.1 + 9.6 x (body weight in kilograms) + 1.9 x (body height in cm) divided by 4.7 x age.
how do I implement in Appgyver?

to make that, you need to create a page variable for each of the variables you have and connect each with an input field, where the user can input his data and then in a button, set a variable called total calories, to the formula you have above, in order to calculate the total calories based on user data.

It would be well worth going through all of the tutorials. Formulas, input and variables are all covered quite well.

Thanks. I have created the page variables and connected them with an input field. And in the button, I have set a variable to the formula. But I want to display the result of my calculation on the next page. So, in this case, I think I should use the page parameter, but I am confused with this part. Any suggestion would be appreciated.

You really, really need to go through all of the tutorials. Your question is covered almost exactly. There is no shortcut to using AppGyver, you need to put in the hard work and do the lessons.

1 Like

I have gone through all the tutorials. But now I got stuck, so asking for suggestions.

Repeat the tutorial and pay attention to app variables.

I also need to point out that this is among the easiest things to do in AppGyver. It can and will get very complicated in order to get through to the stage of a completed app. It really isn´t an entry level solution, so if this task is proving difficult to master perhaps you would get more satisfaction out of one of the other solutions on the market.

I was successful in implementing the formula and it is working well. But I don’t know how do I set the different units of measure ex. for weight kg and lbs. I have used a dropdown list to add it. I am stuck after this. Any suggestions would be appreciated.

I would use different variable for each different thing and then i would use a formula like this to display each.
variable + “kg or lbs”

can you please explain this more?

can you share an image of your frontend and what are the user inputs?

This is the view of my page in appgyver, and the inputs are page variable for the input field. But I still haven’t added any value for my dropdown.

Ok i see, so you are looking on how to add the values? or on how to display the chosen value?

I am looking to how to add and activate the unit of measure for weight and height

If i understand correct, i would suggest that you dont save the variable with the unit added, instead, i suggest you keep each one in a different variable, and use this formula
variable + “kg or lbs”
to add the unit, whenever you want to display the data to the user.
All that, is so that you are able to use the data and add or subtract them, (because with the unit added from the beginning you wont be able to do that).
On the other side, if you are sure you dont need to use the data in the future for anything else than to display it to the user, you can use this function
variable + “kg or lbs”
to add the unit and then save it.

1 Like