Thanks @mikeloc, that was it! I didn’t know about that operator. Not that obvious a solution to me.
However, I don’t know how to apply this custom state to filter a repeating group. I thought it would be possible with the below, but apparently not. Do you know why?
@mikeloc Actually, I don’t think your answer is what I need, or I need some more logic, because deselecting items does not remove the items from the custom state. Do you have idea how to do that?
The ‘Contains’ comparison checks to see if a single defined thing is present in the initial list of things…
i.e. does the Aircraft Class field (which presumably is a list) contain the single thing you define in the expression…
It can’t be used to compare lists to lists…
For that you’ll need to use either ‘Contains List’ or ‘Intersect with’ (depending on exactly what you’re trying to do)… both which can only be used in an advanced filter.
Taking a step back… what is the custom state supposed to be holding? Is it the list of things that have been selected from the multi-dropdown, and when those selections are changed, the custom state should be updated to include only the current selections?
I’m not sure what you tried, but you should be able to set your custom state directly to the multi-dropdown’s value, assuming they are the same type. It should be as simple as this example where I am setting a custom state to a list of users selected in a multi-dopdown.
Yes, your first paragraph is exactly what I need to do. I have just changed it to directly reflect the dropdown list’s value, but I now can’t filter properly! I don’t know how to set up the advanced filter
Well, that’s an entirely different question, and it wasn’t the point of your topic… so, at least this topic is solved.
What are you trying to show in the repeating group? Only things that have all of the selections in the custom state? Or things that have any of the selections in the custom state? If it’s the former, the advanced filter might be something like This Aircraft class contains list requests_all's CS Aircraft class. If it’s the latter, it might look like This Aircraft class intersect with requests_all's CS Aircraft class:count > 0.
Your suggestion to ‘This…’ and ‘intersects with’ solved my filter issue too However, I get a blank list, until I select a dropdown thing. I thought this wouldn’t happen with the ‘Ignore empty constraints’ selected. Unselected, it’s still blank without the CS populated.
Ignore empty constraints doesn’t work with advanced filters, so one way you can go is to add a condition that changes the data source of the repeating group to show all things when the custom state is empty.
As @mikeloc points out, Ignore Empty Constraints does not work on advanced filters…
So, one way to get around that is to do what Mike said and add a conditional datasource when the custom state is empty (or not empty)…
There is a way to avoid having to use conditional data sources though (which, in this case might not be an issue, but if you have multiple constraints it can start to get messy with lots of conditional datasources)…
So, an alternative, is to use an ‘Or’ operator to add to the filter condition, such that the Thing in the list will be included when the custom state is empty…
So, in your case the Advanced filter would be: This Request's Aircraft class intersect with requests_all's CS Aircraft class: count > 0 or request_all's CS Aircaft class: count is 0