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

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

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!

2 ACCEPTED SOLUTIONS

Accepted Solutions
C-Papa
Super User
Super User

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)

View solution in original post

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?

View solution in original post

9 REPLIES 9
C-Papa
Super User
Super User

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)

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
Super User
Super User

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
Helper I
Helper I

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
    }
    )
    )
C-Papa
Super User
Super User

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.

var_scan_no;

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

Looka at the attachement.

C-Papa
Super User
Super User

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)

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?

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!

 

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on June 15, 2022 at 8am PDT.

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Top Kudoed Authors
Users online (2,733)