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.

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
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (3,453)