Trying to build a form that will use pulldata() function to verify barcode ID

Thanks a lot!!!. this works!!! I get the logic now.

1 Like

Addition to this topic
Please add one more thing picture
I want i scan barcode
picture taken from CSV file
Show automatically picture in web browser or andriod application Kobo

Hi
Remember you can customize the whole process using all the available functionalities in one

  1. Barcode as you had been instructed by @Kal_Lam
  2. If the name of the picture is saved in the csv then you can pull this name in a calculate question as an answer e.g. picture1.jpg
  3. You could have response media items that denotes picture1.jpg and then have it pulled from the media file.

You may need to give further illustration of what you intended to achieve since the above example narrows only to inclusion of the picture as a response

Regards
Stephane

1 Like

Hi Kal_Lam,

I simply do not understand the logic in your example.
Why there is no calculate function in your file?
Isn’t this calculate function essential for ODK to pull the right item from the list in CSV?

From lot’s of reading in the here: http://xlsform.org/en/#pre-loading-csv-data I understand, pulldata goes into calculate.

It would be spendid if you could share thoughts or reference asap…

Thanks!

Hi @Lavinia,

Could you please share with us the screenshot of the xlsform where the calculation is missing. It would be easy for me to respond accordingly.

You could look at post 6. It has an example with a calcualtion for the pulldata function. Sorry if i have misunderstood.

Have a great day!

It come from a KoBocommunity member’s post:

here the conversation

1 Like

Hi @Lavinia,

Got you! Kindly please follow the thread of the post that has a marked solution like the one shown in the image below:

Have a great day!

1 Like

@Kal_Lam
Just stumbled upon this thread and its similar to a question I was about to raise. My issue is in my CSV file, I have same barcodes for multiple products. However during data collection, the interviewer needs to select the right product from the list populated after scanning the barcode. Whats the work-around for that?

Thanks

1 Like

@stephanealoo i think he meant displaying the corresponding picture in the app after scanning the barcode. Its something I need help with myself so any assistance will be greatly appreciated.

Regards

Hi @alfidus,

Welcome to the community! Try using the number from a real barcode that you have (and try scanning through the KoBoCollect android app while collecting data) and it should work. The one i used was from a book whose barcode is as follows:

Image 0

Have a great day!

@Kal_Lam, this much I managed to achieve. However there are instances where the same barcode references multiple products. In this instance Id like the app to display all the products related to that barcode and allow the interviewer to select the appropriate products before proceeding.

Thanks

Hi @alfidus,

I don’t think a barcode assigned to a product can be assigned to multiple product as each barcode is unique to the product that it represents.

Have a great day!

Thanks @Kal_Lam. But is there a work-around for popping up the image of the scanned barcode in the APP? Maybe through using the PULLDATA function in the calculated field?

Thanks

Hi @alfidus

You can display all the products related to a barcode by using select one question with search function in the appearance like this:
search(‘csvName’, ‘matches’, ‘columnsToSearch’, ${search_string}).
Where ${search_string} = Barcode value.

Let me know if you need any clarification.

Best,

Yasser

1 Like

Thanks Yaser but can you provide further clarification.
Heres my situation…

  1. I have a barcode question which scans barcodes on products.
  2. I created a text field in my QNR and placed the following in its calculation field.

pulldata(‘Product_List_Loaded’,‘Description’,‘BARCODES’,${Use_the_camera_to_scan_a_barcode})

This works fine but it only displays the first record in the CSV file when there are multiple products for the same barcode.

Hope this helps.

Regards

Hi @alfidus

Instead of the text question, make it select_one question. Let us make it like this
select_one Product
In the appearance column put this formula:
search(‘Product_List_Loaded’,‘matches’,‘BARCODES’,${Use_the_camera_to_scan_a_barcode})
Also in the choices sheet you have to do this:
image

I could help you more if you share with me the xls and csv files.

Best,

Yasser

1 Like

Thanks Ysr,
Tried my hands on it and got this error during deployment.

XLS file - https://drive.google.com/file/d/15MdcURsW66zupkL7dfcFHyWHZdb8sARZ/view?usp=sharing

Product List - https://drive.google.com/file/d/1__WHMKGy3sfD5Qkywn_eEvh44x0S3e1C/view?usp=sharing

apUJWC2cE9K6Nbev5QJY9d.xlsx (10.9 KB)

Product_List_Loaded.csv (4.2 MB)

Appreciate your support Yaser.

Regards

1 Like

Hi @alfidus,

I’ve found two issue in the xls file:
1- search function should be in “appearance” column not in “calculation”
2- select one question should be " select_one Product" not “select_one lu5ot42”
apUJWC2cE9K6Nbev5QJY9d (1).xlsx (11.8 KB)
Let me know the result.
Best,

Yasser

1 Like

Hi @Ysr3322,
This is splendid…worked like a charm. You are amazing. Would have been nice to have pictures of the items beneath the description. Is it possible?

Cheers.

Also…will it be possible to scan multiple barcodes on the same form without necessarily opening a new form for each barcode or placing a specific number of barcodes on the form?
Typical scenario:

  • You enter a store and want to scan all the barcodes on a particular shelf…product count unknown?

Thanks in advance