cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
PurpleDeveloper
Helper III
Helper III

Show Pop-Up if barcode value already present while scanning

Hi Team,

 

I have added a barcode scanner to scan the items. I would like to know how to put a condition on 'OnScan' property to check if that barcode is already present in the CDS table and status is in 'New' and also to show a pop up on the screen while scanning that barcode is already scanned or so..

 

Any help is really appreciated.

2 ACCEPTED SOLUTIONS

Accepted Solutions
WarrenBelz
Super User
Super User

Hi @PurpleDeveloper ,

It would be something like this

If(
   !IsBlank(
      LookUp(
         YourListName,
         YourScanField = Self.Selected.Value &&
         Status = "New"
      )
   ),
   Do whatever
)

 

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.

View solution in original post

Hi @WarrenBelz ,

 

Thanks for all your help.

 

The ID is from Dataverse. And yes, I resolved my problem with below code

Set(
    lastItem,
    First(
        SortByColumns(
            Filter(
                'Table',
                'ID' = Barcode.Value
            ),
            "createdon",
            Descending
        )
    )
);

 

View solution in original post

10 REPLIES 10
WarrenBelz
Super User
Super User

Hi @PurpleDeveloper ,

It would be something like this

If(
   !IsBlank(
      LookUp(
         YourListName,
         YourScanField = Self.Selected.Value &&
         Status = "New"
      )
   ),
   Do whatever
)

 

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.

Hi @WarrenBelz , 

 

Thanks for your quick response. 

 

Can you help with below what you meant? It should be barcode scanned value or the field value from table?

Self.Selected.Value

 

Thanks much!

Hi @PurpleDeveloper ,

Used on the OnScan of the barcode scanner, Self refers to itself, so it is the value just scanned. It is then looking for the value in your data source field and if it finds a matching record, you do whatever is needed.

 

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.

PurpleDeveloper
Helper III
Helper III

Hi @WarrenBelz ,

 

Thank you so much!! It really helps. 

 

One more thing I am trying to achieve in this is while I am searching the barcode value in table, it's possible that value is there multiple times but I need only the most recent one and check if that barcode value is equal to that most recent value from that set of values.

 

For example - Barcode value is - CP001 while searching in table the records I have,

CP001, CreatedDate

CP001, CreateDate...

 

I need to match first if the barcode value is present in the table records and with the value it's checking it's the most recent one.

 

Can you please suggest a way on how to achieve this?

 

 

Hi @PurpleDeveloper ,

You can sort your list by ID descending before the lookup - what is the actual code you are using now?

PurpleDeveloper
Helper III
Helper III

Hi @WarrenBelz ,

 

I am using below code and trying to create a collection of IDs first to get most recent ID to compare with the barcode value.

 

ClearCollect(idgroup, Last(SortByColumns(Filter('Ingredients','ID' = Barcode_Scanner_1.Value ),"name",Descending)));


Set(gvstatus, LookUp('Ingredients',Barcode_Scanner.Value in idgroup.'ID').'Status');

If(!IsBlank(LookUp('Ingredients',Barcode_Scanner.Value in idgroup.'ID' && gvstatus in "Empty").'ID'),Navigate(Full),

If(
    StartsWith(Barcode_Scanner.Value,"CT"),
    Set(gvtbarcode,Barcode_Scanner.Value) And Set(gvScanText,"Scan P") And 
    UpdateContext({togglevalue: true}),
    StartsWith(Barcode_Scanner.Value,"CRP") And Toggle1.Value = true,
    Set(gvpbarcode,Barcode_Scanner.Value) And Set(gvScanText,"Scan T")
));

 

Hi @PurpleDeveloper ,

OK I see you now have DataVerse (ID is from SharePoint), you need to sort by creation date descending and then you will get the newest record.

 

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.

Hi @WarrenBelz ,

 

Thanks for all your help.

 

The ID is from Dataverse. And yes, I resolved my problem with below code

Set(
    lastItem,
    First(
        SortByColumns(
            Filter(
                'Table',
                'ID' = Barcode.Value
            ),
            "createdon",
            Descending
        )
    )
);

 

Thanks @PurpleDeveloper ,

Please remember to Accept as Solution if it helped you solve your problem.

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (3,255)