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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Apps
Suggested Answer

Barcode Data

(0) ShareShare
ReportReport
Posted on by 22
Hi, 
 
I have been reading and watching many different tutorial videos and I still can't find a way to do what I want with my app. 
 
What I would like to do is have an main excel spreadsheet that will keep track of the serial numbers for our product, and what locations they have been installed in. They all come with a barcode (or several) that I would like to be able to simply scan into the app and be entered into a form field. Currently I have a Gallery setup that will display any scanned barcodes, but my problem is how I get that data into a text field. 
 
1) In the example below I would scan (3) different barcodes on the product. They would be Part number, serial number, and lot code. I would like to be able to "highlight" or "select" the correct item in the gallery, then copy it into the proper form field. 
Datacard Default Value 
Button Onselect  
 
I have been messing around with copying variables, creating collections, but I just can't seem to get the data into the data card value. I have tried individual buttons (as indicated above), but it seems to break by gallery from loading all the barcodes. However I just can't I know I could use a copy function on the gallery to copy to the clipboard, but I don't want users to have to hold down their virtual keyboard and paste the item. I would like this to be as quick as possible. 
 
 
2)  I am also trying to build a "running" collection of data. So that when a user types in a value to "Facility" or "Job Number" it will remember those values so long as the app is open. For example if I input a value for "office" in the facility text box and submit that form, then next new entry I open I can start typing "O" and it would populate a value similar to predictive typing. Or if that isn't possible, even just remembering the last value, which I am sure is possible with a global variable? 
Categories:
I have the same question (0)
  • Suggested answer
    CU08111613-0 Profile Picture
    14 on at
    To efficiently move scanned barcode data from the Gallery into the corresponding Text Input fields on your form, you can use global variables and some Power Apps functions like Set()

    Gallery Selection and Button Action: OnSelect of Gallery Item
    Set(SelectedBarcode, ThisItem.Value)

    OnSelect Property of Button (Insert Selected Code Button):
    If(ThisItem = "Part Number", Set(Var_PartNumber, SelectedBarcode),
       ThisItem = "Serial Number", Set(Var_SerialNumber, SelectedBarcode),
       ThisItem = "Lot Code", Set(Var_LotCode, SelectedBarcode))

    For each text input (e.g., Part Number, Serial Number), set the Default property to the corresponding variable:
    If(!IsBlank(Var_PartNumber), Var_PartNumber, "")
    If(!IsBlank(Var_SerialNumber), Var_SerialNumber, "")
    If(!IsBlank(Var_LotCode), Var_LotCode, "")

    (When a user clicks the "Insert Selected Code" button below a specific field, it will copy the selected barcode into that text field without the need to use the clipboard or additional manual steps)

    Create a Collection to Store User Inputs:
    append the value of Facility or Job Number to a collection, whenever the form is submitted.

    OnSelect Property of Submit Button:
    Collect(FacilityCollection, {Facility: FacilityTextInput.Text});
    Collect(JobNumberCollection, {JobNumber: JobNumberTextInput.Text});

    Set the Items property of the Facility text input to enable autocomplete based on values in FacilityCollection:
    Filter(FacilityCollection, StartsWith(Facility, FacilityTextInput.Text))

    If you want the form to remember only the last entered value, you can use a global variable.
    Set(LastFacility, FacilityTextInput.Text);
    Set(LastJobNumber, JobNumberTextInput.Text);

    Set the Default property of the Facility and Job Number fields to:
    LastFacility
    LastJobNumber


    Use a global variable (Set()) to capture the selected barcode from the gallery.
    Use buttons to insert these barcodes into the appropriate fields.

    Use Collections (Collect()) to create a running history of previously entered values.
    Use Filter() and StartsWith() to provide an autocomplete-like experience.

    Use global variables to remember the last entered value for fields like "Facility" or "Job Number".
     
  • NL-07111630-0 Profile Picture
    22 on at
    I didn't think about setting a variable for the selected barcode! That is an excellent idea. 
     
    I seem to be getting a comparison error now. It is generating (3) per button so I imagine it has something to do with the way things are matching. 
  • NL-07111630-0 Profile Picture
    22 on at
    Another thing I just realized with the new text inputs, it is clearing my Parent.Default Value that it is pulling from the values on the form. 
     
    This means that if a user goes to "Edit" an existing form, those boxes show no values. I would think the If (Is Blank) statement would override this? 
  • NL-07111630-0 Profile Picture
    22 on at
    I think I have the majority of what I want working. 
     
    I had to replace the text input boxes with combo boxes so that I could use the autocomplete feature. I couldn't get the Filter(FacilityCollection, StartsWith(Facility, FacilityTextInput.Text)) to work as a text input doesn't allow for "Item" selection. 
     
     
    1. The problem I am having now is the way the box populates from the the form. If I "edit" an existing entry it needs to return the value in the sharepoint list. I can do this by using parent.default. If the value is empty then hitting "insert selected code" will update the value in the box. However I also need to be able to overwrite the parent.default value if they need to make a change. I am trying the following formula, but I just can't make the overwrite function work. 
     
    Note: I have also setup my "submit" and "exit" button to clear the Variable parameters. So that if a form is edited or created the variables should be blank. 
     
     
    2. Is there a way that I can filter out duplicates on a collection? So that if a user just types in a value rather than selecting a value it doesn't appear as a duplicate in the table?  I am going to have to likely build another screen to edit the collection as time goes on so that misspelled records, or records that are not used often can be deleted. 

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 739 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard