Error message of convert string to number

I got "The operation * cannot accept the arguments: , [""], [1]" error message. This is what I used to convert barcode scanner result which is string to number. And I use "do it" to check, it works and is a number.
But AI Companion on my phone display above error message, and stop running.

One of your scans is not returning a result:


You need to test for this before the calculation, and use the afterScan event block for each scan in turn

You are trying to display the result before it is avaliable...
Also why are you scanning twice?

Use the AfterScan event to display the result


Thank you for reminding me that I may not scan correctly which creates"".

Thank you for reminding me to use AfterScan event, I will try to use that event as TIMAI2 also told me that .
My app is to create a referee for military strategy chess board game when playing covered. So that two players can play covered game without third person as a referee. When two pieces meet, just scan the QR code attached to each piece (that's why I need to scan twice) to determine who is stronger by color displayed on screen.

Thanks! Problem solved by using AfterScan event. I will publish this project to the Gallery for you to take look at it and you get the credit for your help :slight_smile: