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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Multiple Bar and QR co...
Power Apps
Answered

Multiple Bar and QR code scan to different columns but same row/obect in Sharepoint list

(0) ShareShare
ReportReport
Posted on by 36

Hi!

I´m building an inventoryapp where im using the Bar and QRcodescanners.

I´m scanning barcode that is Serialnumber on computer, then I directly want the app to change to QR code scanner where I scan an QR code that will be the Title on the computer.

 

I then have a customer column where I manually write the customer.

Two choice columns where I manually choose chargingtype and Modell.

Then I press upload to sharepoint where it uploads everything.

 

But how can i first scan the barcode followed directly with a qr codescan to scan Title and keep doing this in a loop until i press back. I wan´t to be able to multiscan plenty of barcode+qr, barcode+qr, barcode+qr and so on.

 

My uploading code thus far:

ForAll(
collectMultiScan;
Patch(
'Tablets Original';
Defaults('Tablets Original');
{
'Name (Title)': ThisRecord.BarcodeInfoQR;
Serialnumber: ThisRecord.BarcodeInfo;
Customer: DataCardValue20.Text;
Chargingtype: DataCardValue21.Selected;
Modell: DataCardValue22.Selected
}
)
)

 

I now have two buttons where i first scan barcode and another one for qr, but they ending up in different rows in Sharepoint.

Collect(collectMultiScan; {BarcodeInfo: BS_Single_2.Value; Serialnumber: Gallery1})

Collect(collectMultiScan; {BarcodeInfoQR: BS_Single_QR_2.Value; Title2: Gallery1})

 

It would be awesome to just have one button to scan bar and qr multiple times until I back out.

 

Please help!

SP.PNG
App.PNG
Categories:
I have the same question (0)
  • C-Papa Profile Picture
    1,836 on at

    hi, just add Select(BarcodeScanner1) as the last bit of code in the OnScan property. example is

     

    Collect(col_Scan_Codes,BarcodeScanner1.Value);Select(BarcodeScanner1)

  • Hin82 Profile Picture
    36 on at

    Okay, but how can I have the two scanned codes to land on the same item row in Sharepoint?

    As for now it creates tow different objects on every scan. I´m using labels where the scans ends up in the app. Should I use something else like table?

  • C-Papa Profile Picture
    1,836 on at

    try this

     

    Create a button and change its OnSelect to: ClearCollect(col_temp,{ID:"" ,Scan1:"",Scan2:""}). This button will never be pressed, you can hide it if you want. 

     

    With your barcode scanner OnScan add:

     

    If(!var_scan_no,
    Set(lastscanned,Patch(col_temp,Defaults(col_temp),{ID: CountRows(col_temp) + 1,Scan1:BarcodeScanner1.Value,Scan2:""}));Set(var_scan_no,true),
    Patch(col_temp,{ID:lastscanned.ID},{Scan2:BarcodeScanner1.Value});Set(var_scan_no,false));Select(BarcodeScanner1)

     

    This will check if it is the first scan or the second scan, scan 1 will create a new record, scan 2 will edit the previous record. The create a patch function to submit the results to SharePoint once you have finished scanning. 

  • Hin82 Profile Picture
    36 on at

    I´m sorry but I really don´t understand?

    Look at the attached screenshot.

    Dont understand what put in. Down below you find my original setup where I have two buttons. They scan and works, but doesnt scan to the same row but different columns. Main issue. 

     

    My barcodescannersname is:

    • BS_Single_2  (This is the barcodescanner) Code: Collect(collectMultiScan; {BarcodeInfo: BS_Single_2.Value; Title2: Gallery1})
    • BS_Single_QR_2   (this is the QR codescanner)  Code: Collect(collectMultiScan; {BarcodeInfoQR: BS_Single_QR_2.Value; Title2: Gallery1})
    • I have to invisible labels that shows the serialnumber and title when I have scanned (Title and Serialnumber)
    • My upload to sharepoint code is: ForAll(
      collectMultiScan;
      Patch(
      'Tablets Original';
      Defaults('Tablets Original');
      {
      'Name (Title)': ThisRecord.BarcodeInfoQR;
      Serialnumber: ThisRecord.BarcodeInfo;
      Customer: DataCardValue20.Text;
      Chargingtype: DataCardValue21.Selected;
      Modell: DataCardValue22.Selected
      }
      )
      )
    Scan.png
  • C-Papa Profile Picture
    1,836 on at

    i will try do it in steps

    1. Create a button and change its OnSelect to: ClearCollect(collectMultiScan,{ID:"" ,BarcodeInfo:"",BarcodeInfoQR:""}). This button will never be pressed, you can hide it if you want. 
    2. You only need one barcode scanner to get this to work, let use BS_Single_2
      1. Change BS_Single_2.OnScan to
        1. If(!var_scan_no,
          Set(lastscanned,Patch(collectMultiScan,Defaults(collectMultiScan),{ID: CountRows(collectMultiScan) + 1,BarcodeInfo:BS_Single_2.Value}));Set(var_scan_no,true),
          Patch(collectMultiScan,{ID:lastscanned.ID},{BarcodeInfoQR:BS_Single_2.Value});Set(var_scan_no,false));Select(BS_Single_2)
    3. the above step will create a collection called collectMultiScan that will contain the barcode scan in column BarcodeInfo and QR scan in column BarcodeInfoQR but in the same record line.
    4. you then patch your results after you finish scanning in same way you do above
      1. ForAll(
        collectMultiScan As MyScan;
        Patch(
        'Tablets Original';
        Defaults('Tablets Original');
        {
        'Name (Title)': MyScan.BarcodeInfoQR;
        Serialnumber: MyScan.BarcodeInfo;
        Customer: DataCardValue20.Text;
        Chargingtype: DataCardValue21.Selected;
        Modell: DataCardValue22.Selected
        }
        )
        )
    5. Finally clear the scanned collection by adding ;Clear(collectMultiScan) at the end of step 4.
  • Hin82 Profile Picture
    36 on at

    var_scan_no;

    the name is not valid. This identifier can not be identified.

    Looka at the attachement.

    Scan2.png
  • Verified answer
    C-Papa Profile Picture
    1,836 on at

    This is because i have supplied UK syntax and you have not converted it correctly to European sytax.  For example, in the UK we use ';' a semicolon between commands and a ','  comma between properties in the commands.  In Europe you use a ";" semicolon between properties and a ";;" double semicolon between commands. 

     

    it should be something like this

    If(!var_scan_no;
    Set(lastscanned;Patch(collectMultiScan;Defaults(collectMultiScan);{ID: CountRows(collectMultiScan) + 1;BarcodeInfo:BS_Single_2.Value}));;Set(var_scan_no;true);
    Patch(collectMultiScan;{ID:lastscanned.ID};{BarcodeInfoQR:BS_Single_2.Value});;Set(var_scan_no;false));;Select(BS_Single_2)

  • Verified answer
    Hin82 Profile Picture
    36 on at

    I´m sorry for late answer.

    Weird thing is that it doesnt work with your code, but with this code it works,

    Set(lastscanned,Patch(collectMultiScan,Defaults(collectMultiScan),{ID: CountRows(collectMultiScan) + 1,BarcodeInfo:BS_Single_3.Value}));Set(var_scan_no,true);
    Patch(collectMultiScan,{ID:lastscanned.ID},{BarcodeInfoQR:BS_Single_3.Value});Set(var_scan_no,false);Select(BS_Single_3)

     

    But now it puts first same barcode in both Name and serialnumber column. Then when second barcode comes it creates a new row where only the name comes in both columns.

     

    If i use your code, then it still screams on If(!var_scan_no;.

     

    Any ideas?

    Scan3.PNG
    Scan4.PNG
  • Hin82 Profile Picture
    36 on at

    It works! Had to change a little bit in the code! Thank you very much @C-Papa you saved my life! 🙂

    I changed language in my portal and used your code:

    If(!var_scan_no,
    Set(lastscanned,Patch(collectMultiScan,Defaults(collectMultiScan),{ID: CountRows(collectMultiScan) + 1,BarcodeInfo:BS_Single_3.Value}));Set(var_scan_no,true),
    Patch(collectMultiScan,{ID:lastscanned.ID},{BarcodeInfoQR:BS_Single_3.Value});Set(var_scan_no,false));Select(BS_Single_3)

     

    Take care!

     

  • Eaglekad_7 Profile Picture
    43 on at

    How can I put time out on the same line as Time in?

    What code should I do?

     

    Kindly see attached file. TIA

    Scanning out Error.png

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 345 Most Valuable Professional

#2
11manish Profile Picture

11manish 207 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 177

Last 30 days Overall leaderboard