Using toggle as filter

Hi,

I have an analytics page in my app that has numerous elements that all start with the same search, elements when add additional conditions etc or counts to build the display.

Each element is a search for… etc.

Users want to be able to exclude some data from this, so I have added an exclude data field, now in the analytics page I need to change all of the elements to filter out excuded items WHEN an exclude filter is checked, so the user can show data for all or tick a toggle and just show the items with exclude=no

1 - is there a way to have a single search as the starting point so I don’t have to edit a large number of elements/charts every time I make a change

2 - how do I filter the search so that it only filters when a toggle is yes? At the moment I can add a condition to the search eg data_exclude = toggle exclude is not checked but this excludes all when not checked, and displays excluded when checked. The desired function is when not checked it does not filter, when checked the condition should be data_exclude = no

You could store the initial search results in a custom state at the page level, for example Dashboard. Then use that state as the data source to populate the entire dashboard. So you’d have something like:
Dashboard’s list of data:filtered…

This way, the full dataset is loaded once, and you’re simply filtering or hiding elements based on user interaction.

I’d recommend either hiding the data (or group) that the user wants to exclude when a toggle is checked, or updating the data source/state conditionally based on that toggle.

For example…