Composing filter expressions
I'm trying to figure out how to reuse/compose (eg. apply a
not
) a complex expression that I use in filters.
I have a complex filter expression that looks like this:
and then another one that is:
(ie. it's just the not
of the previous one)
Is there a way to extract out the expression so I can do something like:
filter expr(processed)
and filter expr(not processed)
I don't think I can use a calculation because it's using visit
which is a relationship8 Replies
you can add an aggregate, and then use that in the calculation
ohh that's clever haha
another note:
summary_processed_at(is_nil(false))
is probably not what you want
i.e not is_nil(summary_processed_at)
sorry little confused - is there a difference between those two
or just aesthetically the latter is preferred
i was a little confused by the is_nil stuff bc in the docs it said it's used like:
x is_nil true
hmm....gimme a sec 🙂
I believe that is incorrect
you can use it when using the data structure version of filters, i.e
x: [is_nil: true]
huh
looks like that does work
I think I need to undo that
because then you cant call functions w/ the result of is_nil(true)
yeah, okay thats a bug 🙂 I'm fixing it now. It might break people's apps but there isn't really a way around ithaha ok
If I'm right in thinking that the limitation on using attributes of related resources in calculations is primarily about the potential for there to be multiple related resources, could this be supported for
has_one
and belongs_to
relationships?yes, eventually 🙂 I think there is an issue for that actually