Hello folks, I´m going to build an recipe app. Im looking for a portion calculator tool. Is this possible with AppGyver?
Hi, yes that’s possible, you could have number type page variables that you use to multiply the amounts. You’ll need the default portion size and current portions as variables to calculate this.
If you have a recipe where the default portion size is 4 and the recipe uses 100 grams of flour, and you want to display how much that would be for 2 portions:
100 * pageVars.currentPortions / pageVars.defaultPortions = 100 * 2 / 4 = 50
Thanks for the fast response. so the user can change it by himself?
Yes, if you use that formula to display the amounts, and bind the
currentPortions page variable to the value of an input, the value of the variable will change when the user changes the amount of portions in the input.
Note that you might have to use a
NUMBER() formula around the amounts and page variables in the formula, there’s an issue with the input that it converts everything to text.