Hi,
I have a filter with 5 options, let’s call them A, B, C, D, E. I would like to select a different set of columns if a table based on the option selected in the filter. The logic should work like follows:
- If option_selected != “D” OR no option is selected → Display columns level1, level4.
- If option_selected = “D” → Display column level1.
I am able to access the current selected option of my filter like so: '{{filters.ele_filter_id.column_name.values | list }}'
, but how can I select a subset of columns via my table’s custom query ($sql)
?
I have been trying out lots of different possible solutions, but always end up having column level4 filled out with a NULL.
Further people involved: @laura.luckert @FraukeSeesselberg
Hi,
unfortunatelly as far as i can say, there is no build-in feature provided by Apps to do so, but there might be means to do so once combining existing functions the right way.
@magdalena.soeldner might have some ideas based on the following code snippet:
"value": "[{\"name\": {{filters.FILTER_cols.column_name.values | list?separator=},{\"name\": }} }]"
Nevertheless I will bring it to the product to offer at some point in time a standard functionality to cover such an recurring use case.
Managed to solve the issue thanks to help by @kai.geukes with a quite “dirty” workaround in order to select a different subset of columns based on the value of a filter on the option_selected
column.
- Add a column
column_names
containing the column names in the original data table that should be displayed based on the value of option_selected
.
- Create an invisible filter on
column_names
and add it to the current page’s layout. To set the container of this filter as invisible, set the following property on the container:
"id": "container_table_columns_mapping_invisible",
"appearance": [
{
"hide": true
}
]
-
Set the syncset to apply=true
and publish=false
, "selectFirstByDefault": true
, "multiSelect":false
,
on the newly created invisible filter, and sync it with the syncSet of the filter on option_selected
.
-
In the definition of the table being filtered, display the columns dynamically based on the column column_names
of the newly created invisible filter, using the following SQL Query:
"sourceOptions": {
"$sql": {
"type": "string",
"value": "SELECT {{filters.ele_filter_column_names.column_names.values | first }} FROM inputTable i"
}
},
3 Likes
Maybe the new element type “Variable Mapping Select” can be used, which was implemented to circumvent the hidden filter solution suggested above.
see https://internal.onedata.de/apps/apps-docs/odml-documentation/AppBuilder/elements/VariableMappingSelectElement.html#type-variablemappingselect