cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
AaronHB
Level: Powered On

Lookup entry in list

So I know it should be possible to have a lookup that looks to see if a entry is there, if there is it will not do anything and if nothing is there that matches then it will add an entry.

 

So far I have tried this: "Patch(Inventory, LookUp(Inventory,Barcode=BarcodeScanner2.Value),{Barcode: BarcodeScanner2.Value, 'Last person to scan': User().FullName, When: Now()})"

But I realized that this would just look for the scanned barcode and just change the values.

 

Thanks,

Aaron

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
mdevaney
Level 8

Re: Lookup entry in list

@AaronHB 

I think I need to slightly change my earlier code.  Try this instead...

 

If(
    IsBlank(LookUp(Inventory,Barcode=BarcodeScanner2.Value,Barcode)),
    Patch(
        Inventory,
        Defaults(Inventory),
       {
           Barcode: BarcodeScanner2.Value,
           'Last person to scan': User().FullName,
           When: Now()
       },
    Patch(
        Inventory,
        LookUp(Inventory,Barcode=BarcodeScanner2.Value),
       {
           Barcode: BarcodeScanner2.Value,
           'Last person to scan': User().FullName,
           When: Now()
       }
)

 

Other Questions:

What does Barcode2.Value show when you put it in a label? (After scanning)

What does IsEmpty(LookUp(Inventory,Barcode=BarcodeScanner2.Value,Barcode)) show if you put it in a label?

 

View solution in original post

8 REPLIES 8
mdevaney
Level 8

Re: Lookup entry in list

@AaronHB 

My suggestion is to use a conditional statement to check if the record can be found using a combonation of the ISEMPTY and LOOKUP functions

 

If(
    IsEmpty(LookUp(Inventory,Barcode=BarcodeScanner2.Value)),
    Patch(
        Inventory,
        Defaults(Inventory),
       {
           Barcode: BarcodeScanner2.Value,
           'Last person to scan': User().FullName,
           When: Now()
       },
    Patch(
        Inventory,
        LookUp(Inventory,Barcode=BarcodeScanner2.Value),
       {
           Barcode: BarcodeScanner2.Value,
           'Last person to scan': User().FullName,
           When: Now()
       }
)

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

AaronHB
Level: Powered On

Re: Lookup entry in list

Hi @mdevaney 

 

I have tried this and it seemed to send something to sharepoint, but I am looking at the list and what I just scanned is not there.

 

I have double-checked and yes this did not work.

 

Aaron

mdevaney
Level 8

Re: Lookup entry in list

@AaronHB 

Which scenario are you testing?  New barcodes or editting barcodes already in the system?  

 

What does Barcode2.Value evaluate 2 when you put it in a label?

 

AaronHB
Level: Powered On

Re: Lookup entry in list

Hi @mdevaney 

 

I was adding a new barcode and the value is the name of the device.

 

Aaron

Highlighted
mdevaney
Level 8

Re: Lookup entry in list

@AaronHB 

I think I need to slightly change my earlier code.  Try this instead...

 

If(
    IsBlank(LookUp(Inventory,Barcode=BarcodeScanner2.Value,Barcode)),
    Patch(
        Inventory,
        Defaults(Inventory),
       {
           Barcode: BarcodeScanner2.Value,
           'Last person to scan': User().FullName,
           When: Now()
       },
    Patch(
        Inventory,
        LookUp(Inventory,Barcode=BarcodeScanner2.Value),
       {
           Barcode: BarcodeScanner2.Value,
           'Last person to scan': User().FullName,
           When: Now()
       }
)

 

Other Questions:

What does Barcode2.Value show when you put it in a label? (After scanning)

What does IsEmpty(LookUp(Inventory,Barcode=BarcodeScanner2.Value,Barcode)) show if you put it in a label?

 

View solution in original post

AaronHB
Level: Powered On

Re: Lookup entry in list

Hi @mdevaney 

 

The barcode value in a label is the barcode, so the name of the device.

 

And the second it shows false.

 

Aaron

AaronHB
Level: Powered On

Re: Lookup entry in list

Hi @mdevaney 

 

I have changed what you sent form IsEmpty to IsBlank, as it was looking for an empty entry whereas blank checks to see if the value is there. This seems to have worked.

 

If(
    IsBlank(LookUp(Inventory,Barcode=BarcodeScanner2.Value)),
    Patch(
        Inventory,
        Defaults(Inventory),
       {
           Barcode: BarcodeScanner2.Value,
           'Last person to scan': User().FullName,
           When: Now()
       },
    Patch(
        Inventory,
        LookUp(Inventory,Barcode=BarcodeScanner2.Value),
       {
           Barcode: BarcodeScanner2.Value,
           'Last person to scan': User().FullName,
           When: Now()
       }
    )
  )
)

Thanks for the help though.

 

Aaron

mdevaney
Level 8

Re: Lookup entry in list

@AaronHB 

OK.  I've changed the IsEmpty to IsBlank in my post.  Please mark the thread as closed.

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors
Users Online
Currently online: 98 members 5,423 guests
Please welcome our newest community members: