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

1 ACCEPTED SOLUTION

Accepted Solutions
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.

Community Support Team _ Jeffer Ni

If this post helps, then please consider Accept it as the solution to help the other members find it.

View solution in original post

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.

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
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (5,568)