Calculate numbers which are in textbox1,textbox2,etc

Hello slao

You don't tell us what the calculation should be - how about writing an example?

Sir,
thank you for support,
I am making a calculation app and stuck with mathematics
here are examples which are of excel formulas
how can i show a textbox value to be a percentage value
i want calculated value to be shown on label 1 and formula is note: a is in percentage, (axb)+c and another one is ax100/b/100,another is (a-b)-c

http://ai2.appinventor.mit.edu/reference/blocks/math.html

If you want to display one of your numbers as a percentage in a textbox, you will need to do some text manipulation. You will need to reverse this when you want the value back for a calculation

Something like

hello again,
how will i write below examples

(b3xb2)+b17,
(a4-a3)-b1,
a25x100/a4/100
also what is that blue block above is called inb middle and what is places ?

Show your blocks - so what you have tried so far.
And also post a small test aia.

I would recommend you to read the documentation and do some research before you ask.

http://ai2.appinventor.mit.edu/reference/blocks/math.html#format

1 Like

I see you have 9 input text boxes, corresponding to cells B2 ...B9, in orange.

Go down your Designer text box components, and rename them nicely, like
txbProductCostWithoutTax for cell B2, then in the Blocks Editor create a value procedure B2
that retrieves txbProductCostWithoutTax.Text as its return value.

Do that for cells B2 ...B10.

After those have all been done, continue on to code procedures B12 through B21 using math blocks and calls to the earlier procedures.

After that is all working, you can go back and rename procedures B12 through B21 to match their names in column 1, or assign their values into appropriately named Labels.Text

Thanks for responding,
But problem is in multiple operator used eg; (axb)+18% etc...can u show me how to do it I've searched for it but no answer found on this topic

image

edited

like this?

These should get you started.
B15
B13
B10
formulas.aia (2.5 KB)

Use the blue mutator button to add sockets.

https://appinventor.mit.edu/explore/ai2/support/concepts/mutators

P.S.
There is a right click option on most blocks to switch it to external input, which shows nesting better than those internal sockets.

Formatting a fractional number to 2 places is typically done with dollars and cents in the US.

How do you show fractional amounts of money in your country?

taxcalculator.aia (165.6 KB)
i did it today but the answers are coming different i think B3,B5,B10 values are not in percentage it should be in percentage thats why result is wrong also decimal is not coming ex:2459 instead of 24.59
please look in the aia file i attached also how can i send excel file to you so can see te actual result
one thing is you have in b15 block put 0.18 will it be 18 or 0.18

@buyzilla
Your Design panel and blocks are empty. Contains only one VerticalArrangement1

1 Like

grafik

1 Like

borrar_textbox.aia (2.3 KB)

Sir select calculator screen in drop-down there you find design and blocks

Try this one and post at least one or two examples (screenshots) of the results and what the results should be: taxcalculator2.aia (167.4 KB)

1 Like

You seem to be having trouble with percentages.

In Excel, you can format a column or cell as a percentage.
This has the effect of showing 100 times the fractional value and JOINing a '%' after it to show it is a percentage.

AI2 does not have a native percentage data type or any such formatting capability.
It only stores percentages as the fractions that they really are, like 0.18

Does this explanation help?

1 Like

I already showed one way of handling numbers as percentage here (above):

2 Likes

I am going to assume your app is working in rupees (text)
since you use 18% and 'GST' and are exceptionally polite to us.

From looking at your Designer
Designer
your label text lacks sufficient detail to express the units (rupee vs pure number vs percentage of WHAT(PP?)) of the associated text input.

You have 3 text boxes that are in percentages (B3, B5, B10), but you fail to do the required divide by 100 in the value procedures for those numbers.
Designer

Here is my take on a fix, with some non-numeric cleanup added as a separate pass over the inputs ...



B3
B5
B10
taxcalculator (1).aia (166.7 KB)

4 Likes