# An app for orders

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 tag...like 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

Taifun

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?

Taifun

1 Like

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

You can add sockets to the+ block with the blue mutator button.

Come back when you have run out of fingers and toes for counting.