cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Dani77
Helper I
Helper I

power app barcode scanner

hi just trying to create a barcode scanner that will allow you to update a particular column in a sharepoint list tried googling and doing some of the hints but can’t get it to work

8 REPLIES 8
CarlosFigueira
Power Apps
Power Apps

You can have an app as simple as a single barcode scanner control, and in its 'OnScan' expression (which is executed when a barcode is scanned), use something like the Patch function to store the scanned barcode into your SharePoint list, something similar to the expression below:

Patch(
    YourSharePointList,
    Defaults(YourSharePointList),
    { BarcodeValue: BarcodeScanner1.Value })

Hope this helps! 

Dani77
Helper I
Helper I

hi tried that and it not working 

 

the colum trying to update is title sighted i have tried referencing that in as well and not working

Do you get any errors? Can you clarify what is not working?

no error message that i can see but is not updating the column 

You can try a couple things to see why this is not working:

An example of the second way: you can update your expression to something like this:

Set(valueToBeUpdated, BarcodeScanner1.Value);
Set(
    patchResult,
    Patch(
        YourSharePointList,
        Defaults(YourSharePointList),
        { BarcodeValue: BarcodeScanner1.Value }));
Set(
    patchResultJson,
    JSON(
        patchResult,
        JSONFormat.IgnoreBinaryData & JSONFormat.IgnoreUnsupportedTypes));
IfError(
    patchResult,
    Set(
        possibleError,
        JSON({ kind: ErrorInfo.Kind, message: ErrorInfo.Message })))

And have three labels in the same screen that show the result of 'valueToBeUpdated', 'patchResultJson', and 'possibleError'; that would show if any of the input or outputs have a value that are not expected.

hi sorry i think i have confused myself now   i have tried a couple of the solutions and no luck i have attached the latest version on scan that i found in a tutorial and the column i am trying to get it to update 

 

 

Patch(‘mylistname’, LookUp(‘mylistname’, Barcode = BarcodeScanner1.Value),{‘columnname’ : {Value:”Specific Choice Option”}})

I think I understand - you have a list where one column holds the barcode value, and you want to update another column of the scanned barcode... If your expression isn't working, there are a few possibilities of what could be wrong:

  1. The record that you are trying to update cannot be found
  2. The patch request itself is failing

As I mentioned before, there are a few options to identify the problem - running the app under the Monitor, and validating that the parts of the request are valid. For example, for your expression, we can modify it as follows:

Set(valueToBeUpdated, BarcodeScanner1.Value);
Set(recordToBeUpdated, LookUp(‘mylistname’, Barcode = BarcodeScanner1.Value);
Set(
    recordToBeUpdatedJson,
    JSON(
        recordToBeUpdated,
        JSONFormat.IgnoreBinaryData & JSONFormat.IgnoreUnsupportedTypes));
Set(
    patchResult,
    Patch(
        ‘mylistname’,
        recordToBeUpdated,
        {‘columnname’ : {Value:"Specific Choice Option"}}));
Set(
    patchResultJson,
    JSON(
        patchResult,
        JSONFormat.IgnoreBinaryData & JSONFormat.IgnoreUnsupportedTypes));
IfError(
    patchResult,
    Set(
        possibleError,
        JSON({ kind: ErrorInfo.Kind, message: ErrorInfo.Message })))

And add labels with the values of 'valueToBeUpdated', 'recordToBeUpdated', 'patchResultJson', and 'possibleError' that would show if any of the input or outputs have a value that are not expected

v-jefferni
Community Support
Community Support

Hi @Dani77 ,

 

Have you resolved the issue? 

 

If no, what column type is that column you would like to update, Text, Choices or else like LookUp?

 

If it is a Choices type column to be updated, please try below formula in the Button:

 

Patch(‘mylistname’, LookUp(‘mylistname’, Barcode = BarcodeScanner1.Value),{‘columnname’ : {
'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",Value: Combobox.Selected}})              
//or Dropdown.Selected,depending on the Controls you are using

 

 

If it is a LookUp  column, please try below formula:

Patch(‘mylistname’, LookUp(‘mylistname’, Barcode = BarcodeScanner1.Value),{‘columnname’ : {'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
                        Id:Gallery1.Selected.ID,
                        Value:Gallery1.Selected.Title}
              }
})

 

In addition, as per you mentioned that you could not refer to the column by typing in function bar, please notice that any time you have modified the data source, you will need to refresh the connection in Power Apps Studio.

 

Best regards,

Community Support Team _ Jeffer Ni
If this post helps, then please consider Accept it as the solution to help the other members find it.

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Top Kudoed Authors
Users online (1,646)