cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Lift4life
Regular Visitor

Barcode scanner app export gallery to SharePoint list

Hello,

 

I have created the barcode scanner using the following:

 

Create a canvas app with the barcode scanner control (contains video) - Power Apps | Microsoft Docs

 

I would like to export the results from the gallery to a SharePoint list.  I can easily capture the username and seem to be struggling to export the results from the gallery to the SharePoint list.

 

SharePoint list fields are:

Title: Barcode (hardcoded)

Username: Picks up User().FullName

Date: trying to get from gallery Thisitem.ScannedTime

Barcode: trying to get from gallery ThisItem.ScannedItem

 

Current scan button:

 

Collect(
colScannedItems,
{ScannedItem: BarcodeScanner1.Value, ScannedTime: Now()}
);

ForAll(Gallery3.AllItems;
Patch(BarcodeScannerApp;Defaults

 

Any help would be appreciated.  Or should I just export the gallery items to text boxes and then patch to SharePoint list?

 

2 ACCEPTED SOLUTIONS

Accepted Solutions

@Lift4life ,

Assuming you have a valid date format in there, you will get a date with

DateValue(Barcoderesults.Text)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Visit my blog Practical Power Apps

View solution in original post

Thank you, will give it a shot.

View solution in original post

6 REPLIES 6
WarrenBelz
Super User
Super User

Hi @Lift4life ,

Assuming the field names in your list are the same as the ones in your Collection

Patch(
   BarcodeScannerApp
   ForAll(
      colScannedItems As aPatch,
      {
         ScannedItem: aPatch.ScannedItem,
         ScannedTime: aPatch.ScannedTime
      }
   )
)

You could also Patch the gallery, but the collection is more direct.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Visit my blog Practical Power Apps

 

Lift4life
Regular Visitor

@WarrenBelz  Thank you for the details.  I went a different direction and seems to be working a little better.  

 

Now when you scan, it add the info to text boxes seen below

 

Scan button:

 

Collect(
colScannedItems,
{ScannedItem: BarcodeScanner1.Value, ScannedTime: Now()}
)

 

Text box 1:

Gallery3.Selected.ScannedItem

Textbox 2:

Gallery3.Selected.ScannedTime

 

Export to SharePoint button:

Patch(BarCodeScannerList,
{Username:User().FullName, Barcode:Barcoderesults.Text,Title:"Barcode Entry",Date:Dateandtimeresults})

 

The problem is the date and time gives an error when trying to import to SharePoint because I believe it's a formatting issue.  Not to mention, date:dateandtimeresults needs an extension?

 

Thoughts on what I am missing?

 

Lift4life_1-1654627777618.png

 

Lift4life_2-1654627909724.png

 

Hi @Lift4life ,

I thought you wanted to Patch the Collection. Also where is Dateandtimeresults coming from ?

Lift4life
Regular Visitor

@WarrenBelz  Apologies I forgot to mention Textbox1 (top text box) = Barcoderesults Textbox2 (Bottom text box) = Dateandtimeresults.

 

Visually:

Lift4life_0-1654632734710.png

 

I moved away from the collection patching right away because it's better to have a review of the barcode before patching it to SharePoint list.

@Lift4life ,

Assuming you have a valid date format in there, you will get a date with

DateValue(Barcoderesults.Text)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Visit my blog Practical Power Apps

Thank you, will give it a shot.

Helpful resources

Announcements
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.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Power Apps Ideas

Changes to Ideas Coming

We are excited to announce a new way to share your ideas for Power Apps!

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