Hi we are building a CDS sourced app & want to have multiple (4) filters (dropdowns) on the first screen that once set hold across all screens. The fields we wish to filter by are across multiple entities.
Each screen we want to hold the filter over has a form to display data that is ordered and searched via a gallery.
e.g. SCREEN 1 - The first filter we want is called 'Property', it is a common field to all entities. SCREEN 2 - on our assets screen (assets entitiy) we want to filter the gallery by the selection in the first screen.
We have attempted many options and scoured the forums for help but are finally posting. Our current best (but failing) option is using the drop down to set a value "MyProperty" to the selection, then applying this to the gallery, but it doesn't carry.
Part two will be to display an non controllable visual indicating which filters are applied.
It sounds like what you are currently doing is correct - using the Set function to store your variables from the DropDown lists that will persist across screens and use those to filter your galleries. Note that you must use the Set function as UpdateContext will not persist across screens.
DropDownProperties.OnChange = Set(MyProperty,DropDownProperties.Selected.Value) Screen2Gallery.Items = Filter(YourData,Property = MyProperty)
If you are using the Set command already then it might be the case your Screen2Gallery.Items formula could be incorrect given the complexity of having 4 seperate filters and returning the wrong set of results. If you could share what formulas you are using on the dropdown.OnChange event and your Screen2Gallery.items we could have a look to see if there are any issues.
As for part 2 of your question, if following the above method and setting a global variable you could do something like the below but extended for your multiple filters:
ActiveFiltersLabel.Text = "Filters: " & If(IsBlank(MyProperty), "Properties equal anything", "Properties equal " & MyProperty)
Thanks but it is proving very tricky to get working.
Drop down (combo is called M_Filter_Property and is set to)
M_Filter_Property.onchange = Set(MyProperty, Properties_ADAMM.Selected.Value)
The drop down now errors with "The types of the specified context varaiables are incompatible with the types specified elsewhere". No indication where/what it is incompatible with.
FYI - Properties_ADAMM is our entitiy with each property & it's details.
On the assets (screen 2) gallery I tried.
Gallery_Asset_View.Items = filter(Assets_ADAMM, PropertyAcronym = MyProperty)
It didn't work, I'm assuming due to the error on the drop down.
For reference we have built a stacked filter to allow searching by many fields, the filter function will stack into the follwing;
Sort(If(IsBlank(TextInput_Asset_View.Text), Assets_ADAMM, Filter(Assets_ADAMM,TextInput_Asset_View.Text in AssetName,TextInput_Asset_View.Text in LocationofAsset, TextInput_Asset_View.Text in Manufacturer, TextInput_Asset_View.Text in Model, TextInput_Asset_View.Text in RatingorCapacity, TextInput_Asset_View.Text in SerialNumber)), AssetName, If(SortDescending2, SortOrder.Descending, SortOrder.Ascending))
Fill out a quick form to claim your user group badge now!
Find out where you can attend!
Features releasing from October 2019 through March 2020
Learn how to build the business apps that you need.