How to calculate numbers

In my app i need to calculate (Add)Total numbers that are saved in label.whenever user type number from text box it will be saved on label.When total ot click app must add numbers from 1 to 4 and show it on (?)label.How to do that?please help me. If there is some tutorial for that please send me link.Thank you


If empty label is a problem you have to add some “if” control to remember user to write all numbers

2 Likes

That is the problem.If one label has no number and other remaining labels has number how to add them.

1 Like

2 Likes

Thanx i will try this.

1 Like

It works?

1 Like

Thanx today i finished writing blocks and it worked for me. Now i have to do calculation like this
When button 2 click
It should calculate Total ot hour × overtime rate + double ot hour × double ot rate +basic salary.
How can i write this block please explain me.Thank you

you have only to change the name of label in which there is the number and use the right block operation ( + and *) . I don’t know if thunkable follows math rules or make operations in sequence . You have to try. I will take a look when i’m free

1 Like

1 Like

Its not working in my app.would you please check my aia file?

Post .aia here i will take a look when i can or other users can find the mistake👍🏻

1 Like

please see on salary note calculator page<a class=“attachment”
<a class=“attachment”

total OT button works ,i tested it live. I added all overtime and update, then press ot button and it works. Only thing you forgot the notice block that advise for empty label! what don’t work in your app??

1 Like

i left 20 labels blank and only filled 10 labels with numbers so it didnt worked for me.Now i understand i have to put atleast 0/zero in a label

1 Like

Yes man, you asked me a control for empty label. If you add with empty value you get error

1 Like

Is it possible to calculate with some empty labels?If user dont work on some day and they want to leave it blank, can we calculate total ot?

Sure. If i knew you have to work with a lot of label i said you to work with list and not with a big block. You can add one time all the component text label in a list and then work with list method. If i have time i will write some block

1 Like

Ok please teach me easiest method to do this

This is an example how to use list and “for each” (you find it in BLOCKS under CONTROL) and " any component " (you find them at the end of BLOCKS

) .

1 Like

Thank you.should i make same blocks for double ot also?