# Substract from a label from an other one

**URL:** <https://community.thunkable.com/t/substract-from-a-label-from-an-other-one/2528325>\
**Category:** Questions about Thunkable X\
**Tags:** beginner\
**Created:** [August 1, 2023, 10:33pm UTC](https://community.thunkable.com/t/substract-from-a-label-from-an-other-one/2528325 "2023-08-01T22:33:31Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![bertrand.ogieru](https://avatars.discourse-cdn.com/v4/letter/b/ba8739/32.png) [@bertrand.ogieru](https://community.thunkable.com/u/bertrand.ogieru)\
**Post date:** [August 1, 2023, 10:33pm UTC](https://community.thunkable.com/t/substract-from-a-label-from-an-other-one/2528325/1 "2023-08-01T22:33:32Z")

</div>

Hello. This is my first question. I’m a complete beginner and I’m quite sure my question is somehow dumb 😅  
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 ☹  
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

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/d/b/db90fb21bad97de9242fc608e547afb0b8a07552.png)

and here is the link to my project.: [Thunkable](https://x.thunkable.com/copy/7941322f027a02ca08064121cb869209)

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

---

<div class="post-metadata">

**Author:** ![peterjamesleniq](https://avatars.discourse-cdn.com/v4/letter/p/9fc348/32.png) [@peterjamesleniq](https://community.thunkable.com/u/peterjamesleniq)\
**Post date:** [August 2, 2023, 8:12am UTC](https://community.thunkable.com/t/substract-from-a-label-from-an-other-one/2528325/2 "2023-08-02T08:12:20Z")

</div>

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](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/0/4/043287575f130047dacb9deab48cd79561175789.png)

---

<div class="post-metadata">

**Author:** ![peterjamesleniq](https://avatars.discourse-cdn.com/v4/letter/p/9fc348/32.png) [@peterjamesleniq](https://community.thunkable.com/u/peterjamesleniq)\
**Post date:** [August 2, 2023, 8:16am UTC](https://community.thunkable.com/t/substract-from-a-label-from-an-other-one/2528325/3 "2023-08-02T08:16:27Z")

</div>

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

 ![Untitled](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/8/e/8efba9e3d4022d8ab1b1997a2ba1442546d45a64.png)

---

<div class="post-metadata">

**Author:** ![bertrand.ogieru](https://avatars.discourse-cdn.com/v4/letter/b/ba8739/32.png) [@bertrand.ogieru](https://community.thunkable.com/u/bertrand.ogieru)\
**Post date:** [August 2, 2023, 12:08pm UTC](https://community.thunkable.com/t/substract-from-a-label-from-an-other-one/2528325/4 "2023-08-02T12:08:16Z")

</div>

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 😃 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 🙂 in order to help him figuring how much he is actually smoking (because I’m sure he smokes a lot more tha he thinks 😃 ). 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.

---

<div class="post-metadata">

**Author:** ![bertrand.ogieru](https://avatars.discourse-cdn.com/v4/letter/b/ba8739/32.png) [@bertrand.ogieru](https://community.thunkable.com/u/bertrand.ogieru)\
**Post date:** [August 2, 2023, 4:48pm UTC](https://community.thunkable.com/t/substract-from-a-label-from-an-other-one/2528325/5 "2023-08-02T16:48:10Z")

</div>

May I abuse a little bit 😅

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) 😅

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/2/7/27d0c9e138fbf11fd8b6adb196f4656b27d6d298.png)

---

<div class="post-metadata">

**Author:** ![peterjamesleniq](https://avatars.discourse-cdn.com/v4/letter/p/9fc348/32.png) [@peterjamesleniq](https://community.thunkable.com/u/peterjamesleniq)\
**Post date:** [August 3, 2023, 2:42am UTC](https://community.thunkable.com/t/substract-from-a-label-from-an-other-one/2528325/6 "2023-08-03T02:42:58Z")

</div>

Again close.  
Is this what you are looking for.

 ![Untitled](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/f/2/f207bdaf788d1ae104743abdfe42cd171ee9a594.png)

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [August 3, 2023, 6:24am UTC](https://community.thunkable.com/t/substract-from-a-label-from-an-other-one/2528325/7 "2023-08-03T06:24:23Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![bertrand.ogieru](https://avatars.discourse-cdn.com/v4/letter/b/ba8739/32.png) [@bertrand.ogieru](https://community.thunkable.com/u/bertrand.ogieru)\
**Post date:** [August 3, 2023, 7:05pm UTC](https://community.thunkable.com/t/substract-from-a-label-from-an-other-one/2528325/8 "2023-08-03T19:05:34Z")

</div>

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 😅 As a friend says : if you’re stuck with something while coding, it is because you are not looking the right place 😃  
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

---

<div class="post-metadata">

**Author:** ![bertrand.ogieru](https://avatars.discourse-cdn.com/v4/letter/b/ba8739/32.png) [@bertrand.ogieru](https://community.thunkable.com/u/bertrand.ogieru)\
**Post date:** [August 3, 2023, 7:08pm UTC](https://community.thunkable.com/t/substract-from-a-label-from-an-other-one/2528325/9 "2023-08-03T19:08:49Z")

</div>

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 🙂

---

<div class="post-metadata">

**Author:** ![bertrand.ogieru](https://avatars.discourse-cdn.com/v4/letter/b/ba8739/32.png) [@bertrand.ogieru](https://community.thunkable.com/u/bertrand.ogieru)\
**Post date:** [August 12, 2023, 3:11pm UTC](https://community.thunkable.com/t/substract-from-a-label-from-an-other-one/2528325/10 "2023-08-12T15:11:20Z")

</div>

Hello, again. Maybe I’m maybe close again 😅 (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 🙂 ? Maybe better tutorials thant the ones I folowed ?

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [August 12, 2023, 5:14pm UTC](https://community.thunkable.com/t/substract-from-a-label-from-an-other-one/2528325/11 "2023-08-12T17:14:12Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![bertrand.ogieru](https://avatars.discourse-cdn.com/v4/letter/b/ba8739/32.png) [@bertrand.ogieru](https://community.thunkable.com/u/bertrand.ogieru)\
**Post date:** [August 12, 2023, 7:12pm UTC](https://community.thunkable.com/t/substract-from-a-label-from-an-other-one/2528325/12 "2023-08-12T19:12:11Z")

</div>

What a brainless chicken I am 😅 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](https://x.thunkable.com/copy/2ed209b221503a5a9a5eb42467699961)

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/4/4/44f07b355b46bdc523dec2171e484fd2a5df524e.png)

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/0/f/0f59f292712368bce16ff80133ae10de8a6f27e8.png) [@system](https://community.thunkable.com/u/system)\
**Post date:** [November 10, 2023, 7:12pm UTC](https://community.thunkable.com/t/substract-from-a-label-from-an-other-one/2528325/13 "2023-11-10T19:12:47Z")

</div>

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