refine
refine copied to clipboard
[FEAT] Add support for `and` conditional filter
Is your feature request related to a problem? Please describe.
Now that the conditional or filter is available (see https://github.com/pankod/refine/issues/1417) it would be cool to have a complementary and
filter such that the following query becomes possible:
OR(
AND(
{title} == "The Great Divide",
{age} < 10,
),
AND(
{title} == "The New Era",
{age} < 20,
)
)
This would allow to construct complex filters for different situations. Currently it's only possible to do the following:
AND(
OR(
{title} == "The Great Divide",
{title} == "The New Era",
),
OR(
{age} < 10,
{age} < 20,
)
)
One can notice however that these are not the same and the condition for the age is now not tied to the specific titles and in this example {age} < 10
actually being useless since {age} < 20
already satisfies it.
Describe the solution you'd like
An additional and
filter based on the same principle as the or
filter.
Describe alternatives you've considered
The top-level implicit AND
that already exists is good but does limit the queries we can construct if we need to narrow down results individually.
Hey @IgnusG , Great idea! Thank you, let's see what we can do
I would like to work on this,
I just need to add support for and
condition filter in packages/nestjsx-crud/src/index.ts
Am I correct?
Hey @bhagatpratham ,
refine only support OR
filter. In addition we should add AND
support
So the "and" option needs to be added to ConditionalFilter as well, https://github.com/pankod/refine/blob/next/packages/core/src/contexts/data/IDataContext.ts#L69
After adding it, we must implement it in the supporting dataProviders. @pankod/refine-nestjsx-crud
is a good option
https://github.com/pankod/refine/blob/next/packages/nestjsx-crud/src/index.ts#L100
@omeraplak Can i work on this issue if not already taken?
@omeraplak Can i work on this issue if not already taken?
I guess no one has yet. If you plan to do so, we can assign it to you. When do you plan to do it?
@omeraplak Can i work on this issue if not already taken?
I guess no one has yet. If you plan to do so, we can assign it to you. When do you plan to do it?
I would like to work on it just now!
Hey @IgnusG ,
I hope you are very well! We've released and
conditional filters!
https://refine.dev/docs/advanced-tutorials/data-provider/handling-filters/#conditionalfilters
Thanks @omeraplak, that's amazing! Great work @omeraplak and @yildirayunlu 🎉