Create a canvas app with the barcode reader control
The barcode reader control in Power Apps lets you use your phone or mobile device to scan barcodes from various formats.
Some of the common uses of barcode reader control in a canvas app are:
- An app to check in items like books into a collection
- An inventory management app that uses barcode to identify items
- An employee app to check in and badge scanning for security
In this article, we'll create a canvas app with barcode reader and display scanned items in a gallery.
Watch this video to learn how to create an app with barcode reader:
Prerequisites
- Power Apps license
- Before you create an app from scratch, familiarize yourself with Power Apps basics by generating an app and then customizing that app's controls, gallery, forms, and cards.
- To create an app, you must be assigned to the Environment Maker security role.
Open a blank app
Create a blank canvas app.
Add barcode scanner
From the left-pane, select Screen1.
From the left-pane, select + Insert > expand Media > select Barcode reader control.
From the properties list on the right-side of the screen, select Advanced tab, and then select the OnScan property.
Set the OnScan property of the Barcode scanner control to this expression by typing or pasting it in the formula bar.
Collect( colScannedItems, {ScannedItem: First(BarcodeReader1.Barcodes).Value, ScannedTime: Now()} )
From the Properties pane, set X property to "180" and the Y property to "1005".
Add gallery
Select + Insert > expand Layout > select Vertical gallery control.
From the properties pane, select the layout for the gallery as Title and subtitle.
Select the gallery control on canvas.
Set the Items property of the gallery control to this expression by typing or pasting it in the formula bar.
colScannedItems
In the left-pane, expand the Gallery1, and select Title2.
Set the Text property of Title2 to the following expression.
ThisItem.ScannedItem
Select Subtitle2 label, and set it's Text property to this expression.
ThisItem.ScannedTime
Try the app
To test the app, select Screen1, and then press F5 on the keyboard.
After testing, save and publish the app.
Download Power Apps Mobile on your phone.
Open the Power Apps app, and sign in.
Select and open the barcode reader app.
Select Scan, and scan any barcode label (for example, barcode label on a book).
Final Results
You'll see the scanned barcode information is saved inside the app.