cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Regular Visitor

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

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

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."

Highlighted
Regular Visitor

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

Highlighted
Super User
Super User

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?

 

Highlighted
Regular Visitor

Re: Lookup entry in list

Hi @mdevaney 

 

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

 

Aaron

Highlighted
Super User
Super User

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

Highlighted
Regular Visitor

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

Highlighted
Regular Visitor

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

Highlighted
Super User
Super User

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
Ignite

Microsoft Ignite

This will be a conference that you do not want to miss!

secondImage

New Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

August 2020 CYST Challenge

Check out the winners of the recent 'Can You Solve These?' community challenge!

Experience what’s next for Power Apps

Join us for an in-depth look at the new Power Apps features and capabilities at the free Microsoft Business Applications Launch Event.

Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (4,600)