web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Barcode Validation Help
Power Apps
Answered

Barcode Validation Help

(0) ShareShare
ReportReport
Posted on by 40

Hi There,

 

Im currently trying to get a barcode app working in Powerapps, I have it setup atm with a check in and check out button with labels.

The check in button stores the QR Code id and check in time in a sharepoint list, and the checkout button checks the QR Code id and stamps a checkout time against it.

 

Just wondering how I would implement a validation rule so that it checks an excel coloumn for the QR code ID before stamping the check in time? i.e. if the QR ID wasnt in the list it would display a message i.e. QR Code not valid"

 

Thanks everyone.

 

Categories:
  • v-xiaochen-msft Profile Picture
    Microsoft Employee on at

    Hi @samuelGA ,

     

    According to your description, I've made a test for your reference:

    1\ This is list 'LIST75'. It stores all the QR codes.

    v-xiaochen-msft_0-1613529899298.png

     

    2\ Add a BarcodeScanner control 'BarcodeScanner1'.

     

    3\ Add a button control and set its onselect property to:

    If(!(BarcodeScanner1.Value in LIST75.QR),Notify("QR Code not valid",NotificationType.Error),Patch(your check in list ,Defaults(your check in list),{***:***,***:***}))

     

    4\ If the scan result exists in 'LIST75', create a record in the check in list.

    If the result does not exist in 'LIST75', the app will display an error message.

     

    Best Regards,
    Wearsky
    If my post helps, then please consider Accept it as the solution to help others. Thanks.

     

  • samuelGA Profile Picture
    40 on at

    Hi Wearsky,

     

    Thanks for the help, i noticed in the above example it is checking a Sharepoint List for the QR Codes, is it possible to check against a spreadsheet that is stored in sharepoint? (and then continue to stamp the checkin time in a sharepoint list)

     

    I have a microsoft form which users fill out, then i have a flow setup to auto pull the information from this form and it generates a QR code as part of this, so was hoping to validate against this spreadsheet as it would show all users who have completed the form.

     

    thanks again

    Sammy

  • v-xiaochen-msft Profile Picture
    Microsoft Employee on at

    Hi @samuelGA ,

     

    When a user scans the QR code, BarcodeScanner control will get a value. You need to find this value in the data source.

    In sharepoint, the data source is list.

    So, there are two ways to solve this problem.

    1\ Import the data in your Excel into the list.

    v-xiaochen-msft_0-1613554219917.png

     

    2\ Change data source. Make your excel file into a table and save it to onedrive.

    In the canvas app, try to connect to the onedrive connector.

     

    Best Regards,
    Wearsky
    If my post helps, then please consider Accept it as the solution to help others. Thanks.

     

  • samuelGA Profile Picture
    40 on at

    Thanks Wearsky,

    The issue with importing it into a list is that the excel sheet will constantly be updated and dont think you can do an interval sync from Excel to a Sharepoint list.

     

    The Excel is stored in sharepoint - documents, but what you are saying is that if i move the excel document out of sharepoint and into onedrive I should be able to reference it?

     

    many thanks

    sammy

  • samuelGA Profile Picture
    40 on at

    Hi Wearsky

     

    So I edited my flow to sync the form results with a sharepoint list instead of a spreadsheet and have created the coloumn called QRCode, I edited the button based on your help above and getting the following:

    (the lists are called 'SiteAttendance' and 'TestSiteInductionResults')

     

    any ideas?

    OnScan Code.JPG
    Code Error.JPG
  • samuelGA Profile Picture
    40 on at

    Following on from above, I changed the code to better match my values, so now have the following:

    samuelGA_0-1613573437432.png

    If(!(BarcodeScanner1.Value in TestSiteInductionsResults.QRCode),Notify("QR Code not valid",NotificationType.Error),Patch(SiteAttendance ,Defaults(SiteAttendance),{QR: BarcodeScanner1.Value, 'Check In Time': Now()}))

     and now showing the following error:

    samuelGA_1-1613573493558.png

     

  • v-xiaochen-msft Profile Picture
    Microsoft Employee on at

    Hi @samuelGA ,

     

    It looks like you are very close to success. 

    Your formula seems to refer to some wrong names.

     

    I will do a detailed test for you, please check if any steps are different from mine.

    1\ Add a BarcodeScanner control 'BarcodeScanner1'.

    v-xiaochen-msft_0-1613629633606.png

     

    2\ Create a list 'TestSiteInductionsResults' . QRCode is a Single line of text column.

    2.PNG

     

    3\ Create a list 'SiteAttendance'. QR is a Single line of text column. Check In Time is a Date and time column.

    2.PNG

    2.PNG

     

    4\ Now add a button control and use this formula on onselet property:

    If(!(BarcodeScanner1.Value in TestSiteInductionsResults.QRCode),Notify("QR Code not valid",NotificationType.Error),Patch(SiteAttendance,Defaults(SiteAttendance),{Title:"ABCTest",QR:BarcodeScanner1.Value,'Check In Time':Now()}))

    instead of your formula:

    2.PNG

     

    The reason for replacing the formula is:  When the user creates a list, the list will automatically generate a Title column. Title column cannot be blank(). 

    So when creating a record, you need to assign a value to the Title column.

    2.PNG

     

    Best Regards,
    Wearsky
    If my post helps, then please consider Accept it as the solution to help others. Thanks.

  • samuelGA Profile Picture
    40 on at

    thanks alot,

    I confirmed the list settings are correct with the correct format settings, so pasted the above on the to the checkin control:

    If(!(BarcodeScanner1.Value in TestSiteInductionsResults.QRCode),Notify("QR Code not valid",NotificationType.Error),Patch(SiteAttendance,Defaults(SiteAttendance),{Title:"ABCTest",QR:BarcodeScanner1.Value,'Check In Time':Now()}))


    and it is now showing the following error:


    Issue

    A field named 'QR' was specified more than once in this record

    Location

    BarcodeScanner1.onscan


    Thanks Again

  • v-xiaochen-msft Profile Picture
    Microsoft Employee on at

    Hi @samuelGA ,

     

    This is a strange question.

    Could you provide some pictures? For example, the pictures of the controls you use and the pictures of the structure of the sharepoint list.

     

    You can try to refresh the data source .

    v-xiaochen-msft_0-1613698106951.png

    You could also try to delete 'SiteAttendance' list and recreate the list .

     

    Best Regards,
    Wearsky
    If my post helps, then please consider Accept it as the solution to help others. Thanks.

  • samuelGA Profile Picture
    40 on at

    Sure,

    Please see pics of the app, and each of the sharepoint lists settings.

    The Testsiteinductionresults list has 2 flows assoicated with it, 1 were the results are pulled from a microsoft form and the other is against the QRCode field were it prefixes the ID with a naming structure Testsite00 (then the ID number)

    will rename the current siteattendance list and will create one from scratch to see if it fixes the issue.

     

     

     

    PowerApp Pic5.JPG
    PowerApp Pic4.JPG
    PowerApp Pic.JPG

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 220 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 194 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 150

Last 30 days Overall leaderboard