Reputation: 83
I am designing an asset management PowerApp which is based on a SharePoint Online list. It takes fields such as type of item (eg. laptop, server or printer etc.) and allows the user to currently filter based on a scanned barcode.
However I have now created a menu screen, which the user chooses whether they would like to search for a laptop or a server. This navigates them to a different screen depending on what they choose. I would like to filter the data source based on a value within the AssetType
field. This is a multiple choice field that is either Laptops, Servers or Printers
The current formula for the BrowseGallery is SortByColumns(Filter(EquipmentInventory, StartsWith(Barcode, BarcodeScanner1.Value)), "Title", If(SortDescending1, Descending, Ascending))
I have tried SortByColumns(Filter(EquipmentInventory.ItemType == "Laptop", StartsWith(Barcode, BarcodeScanner1.Value)), "Title", If(SortDescending1, Descending, Ascending))
and also
SortByColumns(Search([@AssetType], BrowseScreen_SearchInput.Text in AssetType && AssetType.Value = "Laptops", "AssetType", If(SortDescending1, Descending, Ascending))
to try filter the data source to only show Laptops but I am getting an error of invalid arguments.
Once I can get this working, the expected result would be to have a filter on each screen, displaying Laptops on the laptops screen etc.
I would like each screen to display a BrowseGallery of its assets and then allow the user to still search based on barcode.
Any help greatly appreciated!
Upvotes: 0
Views: 584
Reputation: 231
For the Filter formula try something like: Filter(EquipmentInventory, ItemType = 'Name of screen 1 item type selector'.Selected.ItemType.Value)
The error you are seeing is because the formula is trying to compare two items with different types. To test this, I usually like to add a label to my screen and test each part of the comparison to make sure the values are what I expect. For example, set the label text to be ItemType and the 'Name of screen 1 item type selector'.Selected.ItemType.Value part and make sure they show the same value.
Once you get the filter working, the SortByColumns part should work too!
Upvotes: 0