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.
Solved! Go to Solution.
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
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
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
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.
User | Count |
---|---|
144 | |
142 | |
79 | |
76 | |
73 |
User | Count |
---|---|
230 | |
148 | |
79 | |
67 | |
58 |