cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
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

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

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

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

@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?

 

Hi @mdevaney 

 

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

 

Aaron

@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

Hi @mdevaney 

 

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

 

And the second it shows false.

 

Aaron

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

@AaronHB 

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

Helpful resources

Announcements
secondImage

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.

Power Apps Community Call

Power Apps Community Call: February

Did you miss the call? Check out the Power Apps Community Call here.

New Power Super Users

Congratulations!

We are excited to announce the Power Apps Super Users!

New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

Top Solution Authors
Top Kudoed Authors
Users online (12,578)