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

Lookup Function Help

Hello, I am making a barcode scanning app and need help with data validation. Right now as the app works like so. A worker loads the app the barcode scanner and first picks a Work Order which holds information on where a certain part is in the factory, and the Part ID. Each work order contains multiple parts with multiple locations. So far I have pulled all the necesary data into a gallery. Each gallery contains the Work Order Number and within their are several locations and coresponding part numbers. After selecting the work order number I want to be able to only scan location values and part ID values from the selected work order. 

 

Right now my code is:

 

If(IsBlank(LookUp(Gallery7,BASE_ID=SelectedWorkOrder.Value,BarcodeScanner1.Value)),"",BarcodeScanner1.Value)

 

However this is just not working. Attached are 2 photos. The first one is the work order selector screen and the second one is the actual scanner. Any help would be greatly appeciated! 

 

Max.

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Lookup Function Help

Hi @MaxWendorff ,

Gallery7 is just a control's name. You can not use it as data source directly.

If you want to use it, you need to save the data inside the gallery as a collection.

For example:

ClearCollect(test,Gallery7.AllItems)

If(IsBlank(LookUp(test,BASE_ID=SelectedWorkOrder.Value,BarcodeScanner1.Value)),"",BarcodeScanner1.Value)

What's more, Gallery7.Selected can be seen as a record, not data source.

The synax of LookUp is: LookUp(tablename, formula,[columnname])

So you need to replace the tablename with something that can represent a table.

Here's a doc about this function for your reference:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-filter-lookup

 

 

Best regards,

Community Support Team _ Phoebe Liu

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

6 REPLIES 6
jhall
Level 8

Re: Lookup Function Help

Just to clarify, you're looking to see if the item they tried to scan is in the list they're supposed to be scanning?

So this:

LookUp(Gallery7,BASE_ID=SelectedWorkOrder.Value,BarcodeScanner1.Value)

Is supposed to be looking up what exactly?

I am assuming you're looking to see if the thing that was scanned is found in the List.  In that case, I'd suggest instead of doing an IsBlank() you do a CountIf() or CountRows() to ensure you are getting what you're expecting.  IsBlank() can give unexpected results depending upon your data types.

MaxWendorff
Level: Powered On

Re: Lookup Function Help

 
MaxWendorff
Level: Powered On

Re: Lookup Function Help

Thank you so much for your response! I will start working with that right away but do you know if you can reference a gallery as a data source?? I have had no luck so far 

jhall
Level 8

Re: Lookup Function Help

I haven't specifically tried it, but you can of course use the same source of the Gallery or reference the Gallery1.Selected as a source for a LookUp.

Community Support Team
Community Support Team

Re: Lookup Function Help

Hi @MaxWendorff ,

Gallery7 is just a control's name. You can not use it as data source directly.

If you want to use it, you need to save the data inside the gallery as a collection.

For example:

ClearCollect(test,Gallery7.AllItems)

If(IsBlank(LookUp(test,BASE_ID=SelectedWorkOrder.Value,BarcodeScanner1.Value)),"",BarcodeScanner1.Value)

What's more, Gallery7.Selected can be seen as a record, not data source.

The synax of LookUp is: LookUp(tablename, formula,[columnname])

So you need to replace the tablename with something that can represent a table.

Here's a doc about this function for your reference:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-filter-lookup

 

 

Best regards,

Community Support Team _ Phoebe Liu

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

MaxWendorff
Level: Powered On

Re: Lookup Function Help

Thank you so much it worked perfectley! I do however have an issue that maybe you can help me with. I have the gallery items set to:

 

GroupBy(WorkOrder,"BASE_ID","WorkOrderDetail")

 

This works but I need to add a search bar so the gallery can show results based on the BASE_ID entered in a text box. I do not know how to integreate that into the current code. 

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 (Last 30 Days)
Users online (5,762)