Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for AND/OR filter sections in filter components for Looker 24.0+ #2996

Open
jeromyevans opened this issue Feb 1, 2024 · 2 comments

Comments

@jeromyevans
Copy link

With the rollout of Looker 24.0 (~1 Feb 2024) nested AND/OR filters are available in the Looker for all users[1]. This was previously a labs feature, and while in labs we noticed it broke our use of filter components

The change means filters can be grouped into AND/OR sections in the expression. This means applications using looker filter components also need to support the grouping.

i.e. a list of filter components is no longer sufficient to represent the filter expressions Looker uses.
Screenshot 2024-02-01 at 8 49 26 AM

Are there any plans to implement a new component type / component group to handle AND/OR groups/sections?
Or do applications that use filter components need to change the pay they parse expressions and group filter components the same way themselves?

[1] https://cloud.google.com/looker/docs/and-or-filters-in-explores

@mdodgelooker
Copy link
Contributor

Hi @jeromyevans , thank you posting.

I'm curious what about your usage of filter components generally and specifically the breakage you are experiencing. The addition of AND/OR filters to Explore should be backward compatible in the sense that the shape of the query has not changed. The query.filter_expression (aka Lexp custom filter) will be more commonly used than before, whenever query filters use the OR operator across fields or groups. Does your UI currently render both query.filters and query.filter_expression or just the former? The logic on the Explore attempts to store filters to query.filters whenever possible.

As for plans to add open-source support for the AND/OR/grouping of filters, there are none immediately forthcoming, but please keep in touch with your account reps for more info.

@jeromyevans
Copy link
Author

We allow end-users to create/update schedule plans via API (create_scheduled_plan, update_scheduled_plan). To prepare a new scheduled plan for a Look, we'd fetch the Look and Fields and use the query.filters and query.filter_config and query.filter_expression to prepare a Filter component for each within our app.

In <24.0 if there's 4 filters it's always a list of 4 components: we prepare and render filter A, B, C and D, and the expression's state is inside each Filter.

In 24.0+ a user can defines a new filter group in the UI, such as "(A and B) or (C and D)" which is not possible in the old looker UI AFAIK. To render that the and/or between each group is outside the 4 Filter components. In the screenshot from Looker docs, the 4 filter components are nested in new containers that show this high-level grouping on the left. It may be possible to represent the same thing in an existing filter_expression but I don't think a user can construct equivalent on screen.

I expect we have to create a new parent component to handle the filter groups.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants