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
Solved! Go to Solution.
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?
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
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?
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?
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
OK. I've changed the IsEmpty to IsBlank in my post. Please mark the thread as closed.
Stay up tp date on the latest blogs and activities in the community News & Announcements.
Mark your calendars and join us for the next Power Apps Community Call on January 20th, 8a PST
Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.
User | Count |
---|---|
204 | |
182 | |
71 | |
44 | |
35 |
User | Count |
---|---|
334 | |
267 | |
114 | |
69 | |
66 |