cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
MaxWendorff
Helper II
Helper II

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

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
Continued Contributor
Continued Contributor

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.

 

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
Continued Contributor
Continued Contributor

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.

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

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
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Users online (1,497)