Print QR code data on multiple texbox

Good day everybody,

I’m new of app developing world and I self learned a few of tricks by using MIT Appinventor 2, now I need to create a function for to scan a QRcode with various informations, and report them as strings in various text box.

For ex.:

I generate a QR code for following items:
Name,
Surname,
Address,
Phone etc.

Now I need to create a block that when I scan the QR Code send “name” on textbox1, “surname” on textbox2, “Address” on textbox3 etc.

How can I do? I tried to search it online but found nothing.

Thanks to whom will answer me.

you might want to try the barcodescanner component
http://ai2.appinventor.mit.edu/reference/components/sensors.html#BarcodeScanner
Taifun


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by Taifun.

Thanks Taifun,

I seen but there’s nothing about my question.

The barcodescanner can also read QR codes... Is that not what you want to do?
What about trying something and if you get stuck, post a screenshot of your relevant blocks?

Taifun

So, what I need is to “format” QR code result by dividing data in various textboxes,
I’ve a QR code reporting, for ex., name, address and phone,

now when I scan it I need that my app puts name in the name Tb, address in the address Tb and phone nr. in the phone Tb, like in following pic.

Actually all I’m able to obtain is to have every QR code data in one whole textbox, like in following pic.

and it’s not what I need.

How can I solve it?

Thank you.

When creating the QR code, try separating each field with a comma, then use the list from csv row block to make a list, which you can then use to populate your textboxes.

Peter Smith,123 Blacksmith Street,+1 254 235 122

If your QR code arrives with New Line between fields, that’s \n in AI2 text blocks.

Thanks TIMAI2, I’ve done but nothing…

Thank you everybody for helping, here attached what I’ve done:
blocks

I used math block for to index row items, but what I obtain is always the whole text in the first textbox, then it get me an error message accusing row 2 missing.

P.S. I tried with separatore \n and with comma.

Ah, you are adding the whole list (result) as a single list item into global dati

If you have your data set as delimited by commas

Peter Smith,123 Blacksmith Street,+1 254 235 122

it is probably coming into "result" as a csv row. Use the "list from csv row" block to convert this to an AI2 list.

Replace your add items to list block with:

set global dati block + list from csv row block + result block

This should give you a list of three items that will be placed correctly in your labels.....

it does not look like you know how to debug an App Inventor project...
you might want to display your result after scanning in a label to find out, what exactly will be returned ... is it a list, is it a csv row, what is it?

use Do it to debug your blocks, see also tip 4 here App Inventor: How to Learn | Pura Vida Apps
see also Live Development, Testing, and Debugging Tools

Taifun


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by Taifun.

Thank you very much TIMAI2!

It works!

As I told, I’m not an expert, but I’ve already done everything you said about debugging, may be I wasn’t able to explain what I really need, although TIMAI2 gave me the right answer and now it works.
Thank you very much for your time.
Everyone have his ability, if you need to weld something, just ask to me :wink:

thank you... I will come back to you one day... :wink:
Taifun

1 Like

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