Nested variables

Hi there :slight_smile:

I would like to use nested variables:
I have a dropdown button with two items: 'don’t filter’ and ‘filter according to parameters’.
When I choose the option ‘don’t filter’ I, well, don’t want to apply filtering on certain components.
When I choose the option 'filter according to parameters’ I want to apply a filter that also takes one or more other variables into account.

Currently I have a variable that I use for filtering, where the variant including filters looks something like this:
FILTER "MY_TABLE"."MY_COL" > <%= myvar %>;

However, this does not seem to work as the myvar variable is not replaced by the value of the variable.

Any ideas how I can have a filter that is disabled, or executed using other variable(s)?

1 Like

Hi Joos,

you can try to use

<% if(var != "don't filter") { %>
FILTER "MY_TABLE"."MY_COL" > 1;
<%  } %>

as a component filter. You would store the don’t filter and filter according to parameters option in variable var. If you select the don’t filter in the button dropdown, the components filter will not be applied.

Hope this helps.

Best,
Viana

2 Likes

Hi Viana,

This reads like a nice feature to handle variables, with it’s own piece of (sub) codes within PQL.

Is there a help page somewhere where I can find more information about the ‘var’ environment?

Best,
Joos

Hi Joos,

var is more of a variable than an environment. We unfortunately don’t have documentation of statements like these.

Best regards,
Viana