Custom logic for variable value selection based on another variable

What is a simplest way to embed js / implement custom logic for chained variable selection ?

ISSUE:
We have drop down selection list for container/pod. Based on it’s value i want to set LogQL filter into another variable, such that it will allow to embed this filter into single generic query like this ‘{container="$container"} ${POD_SPECIFIC_LOGQL_FILTER:raw}’.

EXPECTED
Any way to embed JS or using built-in Grafana tools to set $POD_SPECIFIC_LOGQL_FILTER based on $container var with default value , such that there is no need to set $POD_SPECIFIC_LOGQL_FILTER for all containers, but only for those, who doesn’t feet into common log format.

It sounds like you want to use chained variables. Here are some useful starting points and example dashboards in our public sandbox :+1: