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 Platform Community / Forums / Power Apps / Possible? Scan 40 barc...
Power Apps
Answered

Possible? Scan 40 barcodes with PowerApps, Push 10 records of 4 columns to SharePoint with one click.

(0) ShareShare
ReportReport
Posted on by 6

Scanning 40 values into a collection (code 128) is easy enough.  Pushing that to SharePoint in the correct format is challenging.  Imagine scanning 4 barcodes from one PC ...  manufacturer, model, serial number, Inventor tag.   Next PC, Next PC ... etc.  The scanned "Value" would need to go to a SharePoint list where the first four values from the scan ended up in MFG, Model, SN, Tag columns for the first PC, the next four for the second PC, etc. The user scans 4, 10, 50 PC's and clicks once to process serial string to parallel records.

 

Any ideas would be appreciated.   

 

Categories:
I have the same question (0)
  • Verified answer
    WarrenBelz Profile Picture
    153,073 Most Valuable Professional on at

    Hi @VanceLeeMeurer ,

    A bit of a brain-toaster, but I believe this will work - I am assuming that your current collection has one field called Value

    With(
     {
     _List: 
     RenameColumns(
     YourCollection,
     "Value",
     "Code"
     )
     },
     ClearCollect(
     colScanned,
     ForAll(
     Sequence(CountRows(_List)),
     Patch(
     Index(
     _List,
     Value
     ),
     {ScanNo: Value}
     )
     )
     )
    );
    Clear(colCodes);
    ForAll(
     Sequence(CountRows(colScanned) / 4, 1, 4),
     Collect(
     colCodes,
     {
     MFG: 
     LookUp(
     colScanned,
     ScanNo = Value
     ).Code,
     Model: 
     LookUp(
     colScanned,
     ScanNo = Value + 1
     ).Code,
     SN: 
     LookUp(
     colScanned,
     ScanNo = Value + 2
     ).Code,
     Tag: 
     LookUp(
     colScanned,
     ScanNo = Value + 3
     ).Code
     }
     )
    )

     

    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.

    MVP (Business Applications)   Visit my blog Practical Power Apps

  • VanceLeeMeurer Profile Picture
    6 on at

    I spent four days with YouTube videos, searching web pages, and hours talking to Co-Pilot with no success.  Your code worked like a champ.  Thanks so much for your help.

  • WarrenBelz Profile Picture
    153,073 Most Valuable Professional on at

    @VanceLeeMeurer ,

    That is why HI will beat AI for some time yet.  I doubt if anyone has needed to do what you are proposing before. Please take some time to understand what I have posted - it may help you in the future. 

  • VanceLeeMeurer Profile Picture
    6 on at

    I have reviewed your code and hopefully soon it will all click.  I've done several things in PowerApps but I'm still a newbie.  I came up with several ways to do this ... in VBA but none of those work in PowerApps (no setting variables inside a forall ... argh).  Just so you'll know the PC inventory was not the current project (future yes).  The current project is to scan bags of blood products on Ambulances and Helicopters at a 501c3 first responder company to ensure it's all tracked and not a drop is wasted.   Thank you again!

  • WarrenBelz Profile Picture
    153,073 Most Valuable Professional on at

    Hi @VanceLeeMeurer ,

    I might as well comment it before it fades from my brain . . 

    With(
     {
     _List: 
    	 //grabbing the collection, but Value causes ambiguity further down, so renaming the column
     RenameColumns(
     YourCollection,
     "Value",
     "Code"
     )
     },
     // Adding a field ScanNo, which is a sequential number for all items
     ClearCollect(
     colScanned,
     ForAll(
     Sequence(CountRows(_List)),
     Patch(
     Index(
     _List,
     Value
     ),
     {ScanNo: Value}
     )
     )
     )
    );
    Clear(colCodes);
    ForAll(
     Sequence(CountRows(colScanned) / 4, 1, 4),
     // now iterating through the collection - times is rows/4, starting at 1, but in steps of 4 (1,5,9,13 etc)
     Collect(
     colCodes,
     {
     MFG: 
     // This is the tricky bit - find the record where the added field number equals the sequence number
    		 // Remember these are in steps of 4, so every fourth record will be MFG
     LookUp(
     colScanned,
     ScanNo = Value
     ).Code,
    		 // Add 1 for Model - it will be the next field in each sequence - and so on for the rest below
     Model: 
     LookUp(
     colScanned,
     ScanNo = Value + 1
     ).Code,
     SN: 
     LookUp(
     colScanned,
     ScanNo = Value + 2
     ).Code,
     Tag: 
     LookUp(
     colScanned,
     ScanNo = Value + 3
     ).Code
     }
     )
    )

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 721 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 320 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard