cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Basic_user55
Frequent Visitor

Barcode scaner

Ive looked around on the forums a good bit and seem to be getting more confused. 

 

Goal: From inventory gallery list screen, scan barcode of product, goto that product screen.

My issues: List works, scan works, when going to the detail screen, it just has the first item details selected.

 

My scanner onscan function

 

 

Set(
     varCurrentRecord,
     LookUp(
         'Warehouse ',
         Barcode = BarcodeScanner1.Value
     )
 );

 If(
     IsBlank(varCurrentRecord),
     Notify(
         "Item not found",
         NotificationType.Error
     ),
     Select(varCurrentRecord2);
     ResetForm(Form3);
     Navigate(scan1);
     
 )

 

 

 varCurrentRecord2 is the name of the inv gallery.

 

This is the detail screen. I'm sure it's something simple i'm just overlooking. 

ss1.PNG

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @metsshan ,

This requires a bit more record management here when you are selecting items from multiple sources (the gallery and your barcode scanner. Firstly to set this up, OnSelect of your Gallery (I assume here scan1 is the screen with your Form)

Set(gblRecord, ThisItem);
Navigate(scan1)

Then the Item of your Form

LookUp(
   'Warehouse ',
   ID = gblRecord.ID
)

then the rest becomes easy - OnScan of your Barcode Scanner

With(
   {
      wRecord:
      LookUp(
        'Warehouse ',
        Barcode = Self.Value
      )
   },
   If(
      IsBlank(wRecord.Barcode),
      Notify(
         "Item not found",
         NotificationType.Error
      ),
      Set(gblRecord,wRecord);
      Navigate(scan1)
   ) 
)

 

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

12 REPLIES 12
BCBuizer
Super User
Super User

Hi @Basic_user55 ,

 

A form, as on you detail screen, typically only shows a single item, so can you please clarify what you expect to see there, bearing the previous comment in mind?

 

Also, what is an inv Gallery?



Did you like my post? Please give it a thumbs up! Did I resolve your issue? Please click Accept as Solution to close the topic and so other members of the community can find solutions more easily.
metsshan
Solution Sage
Solution Sage

Hey @Basic_user55,

 

I think the problem is with your Form Item of 'varCurrentRecord2.Selected'.

As far as I've seen, there is no way to set the Selected item in a Gallery from an external control.

Usually you would perform a LookUp to initialise a Form from something like a barcode scan or a button press. You've already done the LookUp we need, so perhaps try changing your Form Item to your lookup variable: 

varCurrentRecord

 

Let me know if that works!

Hi @metsshan ,

This requires a bit more record management here when you are selecting items from multiple sources (the gallery and your barcode scanner. Firstly to set this up, OnSelect of your Gallery (I assume here scan1 is the screen with your Form)

Set(gblRecord, ThisItem);
Navigate(scan1)

Then the Item of your Form

LookUp(
   'Warehouse ',
   ID = gblRecord.ID
)

then the rest becomes easy - OnScan of your Barcode Scanner

With(
   {
      wRecord:
      LookUp(
        'Warehouse ',
        Barcode = Self.Value
      )
   },
   If(
      IsBlank(wRecord.Barcode),
      Notify(
         "Item not found",
         NotificationType.Error
      ),
      Set(gblRecord,wRecord);
      Navigate(scan1)
   ) 
)

 

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

True, thanks for the edit @WarrenBelz, I did not catch on that the Gallery OnSelect() needs to Navigate to the Form as well.

thank you for your assistance, using this code I get a syntax error 2.PNG

It should be a colon ":" after wRecord in your With() record initialisation, not a comma, eg:

With(
   {
      wRecord:
      LookUp(
        'Warehouse ',
        Barcode = Self.Value
      )
   },
   ... more code ...
)

Try a colon : instead of a comma , after wRecord. I will fix the typo on the original when I get back to my PC.

Basic_user55
Frequent Visitor

Thank you to you both, sorry to be such a pain but.... 

Capture3.PNG

when I added the : looks like the error moved down. I tried to fiddle with it, but no luck. 

Semicolon ';' after "Set(gblRecord, wRecord)"

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,986)