The operation + cannot accept argument [0],[''']

hi im making barcode scanner app for groceries shopping where you can scan the barcode, fill the item name and price.
i want to total up the groceries price but, there is an error occur. i have attach the block picture. hope anyone can help me :frowning:

This problem is coming because you are adding 0 to nothing.

The price tags text is nothing. So you are not able to add.

How can I change it? Because I kind of confused, I have stuck with this. Do you have any suggestions?

What is the Price?

Here is a helpful value procedure, that turns empty text into a zero for unbreakable math ...

But the Price is not changing at all.

The price need to be key in in the text box

If this was meant to be a a screen recording, it isnt..

im sorry, what im trying to say on the previous reply is, i need to key in the price manually. but after the price is key in and I press total button, the operation + says that it cannot accept the argument. I don't understand how to pass the value (price) to the total button :frowning:

First you have to use this block to set the text of Price - SET Price TEXT TO othervise the value will not change at all.

1 Like

When you click TOTAL you can also check if the PRICE text is empty. If it is empty then ask the user to enter the price with the help of Notifier.

The price field is probably not a problem since you enter data there before clicking. The problem is a badly declared total variable. Declare it as "0".
And do it:

You might want to read this sample for adding up a shopping cart.

Thank you all, it really working now! Thank you for answering my questions​:pleading_face::cherry_blossom:

1 Like

If solved click on the solution button.


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