Hello dear AppBuilder,
I would like to use a multiselect filter and filter my time series chart based on the selected forecast horizon. It should be possible to select one month but also two.
The value of the filter will be part of the sql query that modifies my data.
The problem I face now is following: It works with single select (values.0) or when I take as much filter values as mentioned in the query (values.0, values.1 etc), but I have no flexibility in varying the number of filter values selected.
Any other ideas how to cope with that use case?
SELECT
*,
CASE
WHEN historic_fc_period = {{filters.fi_fc_horizon.historic_fc_period.values.0}}
OR historic_fc_period = {{filters.fi_fc_horizon.historic_fc_period.values.1}} (etc.) THEN ufe_fc_value
ELSE NULL
END as modified_fc_value,…
“{{filters.fi_fc_horizon.historic_fc_period.values}}” would give you a string of the form [“selected_value_1”, “selected_value_2”, “selected_value_3”]. You could use regex to get rid of the [, ] and " and then split by comma to get an array. Then you could check if that array contains “historic_fc_period”.
However, this is not the cleanest solution and maybe someone knows of a better approach.
Have you tried variable transformation already? I think it is designed for that purpose
…/apps/apps-docs/odml-documentation/AppBuilder/global/Global.html#variable-transformations
5 Likes
Thank you Kai for the hint.
In my case it worked with {{filters.filter_id.col_name.values | sqlList }}
A integer will be resolved as (1, 2, 3) and can than be used with in an WHERE IN or WHERE NOT IN statement.
1 Like