I’m trying to make work this kind of condition :
NOT({% condition has_not_property %} property {% endcondition %})
has_not_property
is a check list allowing an array of values to be selected (property
is an ARRAY<STRING>
). The issue is that when I have a default value on my filter (no value selected), NOT({% condition has_not_property %} property {% endcondition %})
becomes NOT(1=1)
<=> false
, so… no values end up being selected : users would not understand.
The issue is that templated filters (https://cloud.google.com/looker/docs/templated-filters) behave as a black box which is hard to interact with. I cannot write “if not values are selected then <true> else <apply_the_filter_logical_expression>”.
I found the post below, which seems to be a solution. It’s actually not, since it doesn’t work : CAST({% condition filter_name %} sql_or_lookml_reference {% endcondition %} AS STRING)
becomes CAST(1=1 AS STRING)
, which becomes “true”
(the logical expression 1=1
is executed first) and not “1=1”
as claimed.
=> I’m searching a solution to make that NOT
filter work, with a special case of the default value (1=1
) which I would like to be replaced by true
in the WHERE part.
The best idea I’m having right now is to compute a new column on my data table, has_not_property ARRAY<STRING>
, so that I can filter this way {% condition has_not_property %} has_not_property {% endcondition %}
.