Add ability to control which query builder operators are available for each field

Hi. I'm new to Retool and have a couple questions about the Query Builder component.

  • Small nit, but I think the description in the Docs is placeholder text.

  • When you select the enum choice "Status" and choose "In" or "Not In", the MultiSelect starts with an empty displayValue. Do I need to to clear that out each time or am I missing something?

  • I'm hoping to use Query Builder to progressively filter a Table, curious if this is something you've seen before. I want to start with a table displaying the results of an initial query. Query Builder could then be used to add whatever Rules and Groups, which would trigger both a refresh of the table with the new query results *and* update the Query Builder Field choices with a list of possible choices. For an enum, I would only want to show the options remaining (a select of the distinct values for a given field in the query.data?). I would also want to allow users to save their Query Builder Rules/Groups so they could come back later and not have to do it all again from the top.

  • Lastly, does this sound possible with the Query Builder or would it require a custom component? I would like to have different filter operators depending on the field's data type -- Enums only get Null/Not Null and In/Not In; Dates would get date ranges, Numbers would get ranges but not In/Not In, etc.

Thanks!

2 Likes

+1 for being able to control which operators are available for which field. It would be awesome to be able to add a key to the field dictionaries for the QueryBuilder, containing an array of the operators to allow.

The docs are updated, thanks! https://retool.com/components#QueryBuilder
For the empty displayValue, you can clear that out or set a default:


If you're looking to "save" the new Query Builder Rules/Groups that users create, you'd need to save this info to a db or API.
Yes, you can filter a table based on selections in the query builder. You'd likely want to use a transformer to create a dynamic array of Fields for the query builder component

Then, for your table, you'll add in the query builder rules:


1 Like

I'm moving this to a feature request for being able to control which operators are available for which field 🙂 Thanks for the feedback!

1 Like

Hello @Tess!

Do you know if this feature has been planned already? Or even released?

Thanks in advance,

Cheers

Hi @AlexSul! This isn't on our roadmap yet, but we'll post here if we have any updates

+1

Built into React Query Builder already

+1

Is this component on your roadmap? It will great if it can have a fresh new look with some of the features https://react-querybuilder.js.org/ has like drag-and-drop or the one mentioned in this thread

Unfortunately, this component is not on our immediate roadmap, but this request is still being tracked internally - it always helps to hear there is still interest! I've added your +1 internally as well.

+1
it could be even more customizable to be really useful.

1 Like

+1

+1