An app for orders

I want to make an app that someone can use to order products. e.g. from a restaurant to be able to order something to eat and the order to be sent to the restaurant e.g. by email and that he sends everything he has ordered along with the total cost of the order.
I started something, but trying it gives me an error, and the email does not include the order in its cost.

Order.aia (4.2 KB)

Try with this.

you can use this extension to send email:

1 Like

The emailing thing is solved, but when I put an amount on the order it gives this error.

Because you are multiplying the p's and q's every time you change one...if you change q1, you also multiply 2 and 3...even if they are empty..

How do I fix this?

Do you understand the problem? why and where it is generated?

Unfortunately, no

When you modify "q1" (and q2 / q3 are empty):


you call to the procedure "computSum", where you are also multiplying q2 and q3, which are empty:

that is the error...

the same occurs when you change q2 (and q3 is empty).

But shouldn't they be empty, so that the customer can place the quantity he wants?

So add appropriate protection in the form of conditions so that multiplication does not occur when the text box is empty.

Yes...the error is not the empty fields...the error is to try to multiply an empty Patryk says protect those operations to be executed only if there is a value.

What does protection mean in this case, I make some changes to the blocks and the problem persists

This is also called data validation
Before doing a multiplication you have to check, if both values are not empty

If is empty a
Then display 'please provide a value for a'
Else if is empty b
Then display 'please provide a value for b'
Else do the calculation


How would you multiply p1 x q1, only if both fields are not empty? Write it here in natural language.

(well, Taifun has done it before...)

Try to "write" it with the blocks.

How do you write this with blocks?
"If is empty a"

1 Like

You do not know how to use an If statement as shown earlier?


1 Like

This NZ value function turns blanks into zeroes, to make it easier to do math with blanks:


App Inventor 2 Book: Create Your Own Android Apps
FAQ Section: Books, Tips, Tutorials for AI2