Substract from a label from an other one

Hello. This is my first question. I’m a complete beginner and I’m quite sure my question is somehow dumb :sweat_smile:
I’m trying to make something I was thinking simple but not for me. In my Design I have the First label (Label 1) which is populated by the Add button. The second Label (Label 2) is populated bye the slider.
I just want to substratct Label 2 to minus Label 1 and get the result in label 3.

I’m really sorry if there is already the same topic, but I’ve read a lot of topics, didn’t find what I’m trying to achieve here :frowning:
An other question, after I succeed with your help (I hope), do you think it is possible to block a user from entering a number in a lable more than once a day ? And reset this number once the day is finished ? (to allow user to enter a new number but only a day after). Here is a screen capture from the blocks screen

and here is the link to my project.: Thunkable

thank you by advance for any kind of answer you would give to me.

1 Like

Is this what you are looking for?
It looks like you were really close to this answer.
I got the Blue Minus utility from the “Math” section
If it isn’t the answer, please re-word your question, and I’ll try again.

Untitled

I added a few things just to get rid of some errors when the screen opens.

Hello Peter and many thanks for your answer. It works and yes, I guess I wasn’t so far, I think I didn’t pay enough attention to the Maths operators. I get rid of the initialize Stored variable which was not usefull at all :smiley: I’m tweaking a little bit to change some Font values when the label 3 is displaying negative numbers, and still looking for a way to block the max of label 2 choice only once a day (the user has to choose a max day by day) and reset it at the end of the day. For information I’m doing it to learn Thunkable but also for a friend who tries to lower the somkes he ligths each day :slight_smile: in order to help him figuring how much he is actually smoking (because I’m sure he smokes a lot more tha he thinks :smiley: ). When I will be more skilled with Thunkable I would like also to produce daily data’s but It will be an other story. Thanks again Peter.

May I abuse a little bit :sweat_smile:

I’ve tried this afternoon to work on font color change, like positive numbers in Label 3 are green, otherwise, negative numbers are red.

This is what I’ve tried (but doesn’t work. I’m guessign this is because the initial confition is not working but I’m not sure) :sweat_smile:

1 Like

Again close.
Is this what you are looking for.

If you use a stored variable, you need to initialize it.

To do that, when screen opens, if stored variable equals null, set stored variable to zero.

This is exactly what I wanted to do. Again thank you Peter. As I understand it, I did find the right solution but not in the right place :sweat_smile: As a friend says : if you’re stuck with something while coding, it is because you are not looking the right place :smiley:
So I will add a solved tag to this post.
I will try to find myself a way to prevent user from entering a max more thant once a day (and so reset it every day, but I think I understood part of this feature) and after maybe store and publish some datas.

Big thank you Peter

1 Like

Hello Tatiang ans thank you for that clarification. I did find that I had to initialize it but I didn’t understand the trick with the setting :slight_smile:

1 Like

Hello, again. Maybe I’m maybe close again :sweat_smile: (or far from it)

I did modify some features and tried to use Stored variables. I followed tutorials but I certainly don’t get something. I’ve set up a reste button, which is quite working. I have now have some minor issues :

  • I want my data to be stored. It works fine for the Add smoke panel but I don’t understand how to to it for the Max Smokes panel.

  • when the reset is applied and after reloading the screen, My max smokes doesn’t reset to 0 (whiwh is what aim to do), work fine for the count panel (add smokes), but not for this one.

  • when reloading the panel, I now have the add smokes panel displaying the last value (before reloading) and not the max smokes panel. Therefore the remainig smokes panel displays an “NaN” value, and I was expecting it to display something like the substraction from one to the other one panel (ie : 0 for Max Smokes, and less X smokes in the remaining count). I think this problem is due to the fact the first panel (max smokes) doesn’t load a numeric value but a kind of “no value” after reloading.

Any clue :slight_smile: ? Maybe better tutorials thant the ones I folowed ?

Telling us what isn’t working is only half of the information that anyone here needs to help you. We have to see your blocks either in screenshots or a link to your project.

What a brainless chicken I am :sweat_smile: Sorry
The worst is that I did prepare the link and a print screen but forgot to include them in my previous message… Here they are :
https://x.thunkable.com/copy/2ed209b221503a5a9a5eb42467699961

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.