I am looking for some advice on how to add a number to another existing number.
Some back ground, this is my first ever app and I am no coder, I have some issues to understand the logic
My app tracks my gym workout, the idea is that I have an exercise, for which I plan to do x number of reps with x amount of weight. the exercise will have an image (a thump up) that when pressed will add 0.5 to the existing number for next time I do that exercise.
From the image below you can see I start the exercise with 2kg and the plan is that if I press the thump up the 2 will become 2.5 for the next time.
beside not having idea how to do this, my first issue is that when I view the app on my phone the 2 shows as a zero.
Please consider my total inexperience if you provide some guidance.
Store the mass as a page variable (or app variable), with 2 as the initial value. Lets say you call this “Mass_Variable”. In the button logic when tapped, use “set page variable” and select “Mass_Variable” For the assigned value, use the add function, set “Mass_Variable” as the first value and 0.5 as the second. You can display the value to the user using a text box, and having “Mass_variable” as the value and + “kg” for the unit.
I tested it, works well, very simple
Thank You very much for the instructions, I have to say I am proud that I was actually able to follow them. You were very clear,
I do however have a question, what you did works but how do I prevent it from resetting to the original value every time I close the app?
I understand, you mean you want to save the data (for each user). To do that, you’ll have two main options:
On device storage: This is best for you, since your app is simple and doesn’t need internet connection, or anything like that. (As the name suggests each users data is stored on his own device) There are videos on youtube which you can watch to help you, like this: Appgyver Save Variables To Device Storage - Long Version - YouTube
https://www.youtube.com/results?search_query=appgyver+on+device+storage (and these)
The second option is to use a no code backend to save data and use rest api integration.( The data is not stored on the users device but rather on a server). I don’t recommend this to you, because these are easy but take a while to learn and have monthly costs. Your app is simple so it really doesn’t need it, however if you plan on making your app a lot more complex or want to make more apps I suggests you use one. (This also requires the user to have an internet connection). I use Xano which has a free plan, and there are threads on the forum about the pros and cons of all the popular no code backend.
Nice tutorial, I can reproduce it but because I need to simplify it I am having troubles.
I decided to make my app even simpler
Let’s say 1 field and one button (not sure the button is necessary)
I enter a value in the field and the expectation is that the value will stay there next time I open the app unless I change it manually by typing a new value. All on 1 single page.
The tutorial would enter a value and display it on another page I cannot understand the logic of it.
I started to watch tutorials about variables to understand how they work but before I am done it will take some time