Dynamicly build filter

Using Flux, is it possible to dynamically build the contents of the filter? For example:
from(bucket: “slo”)
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => “${queryFilterStr}”)

where $queryFilterStr could be something like:
r._measurement == “resp_time” and r.app_name == “app1” and r._field == “value95” and r._value > 1.2

My end goal is to build repeating rows of panels within Grafana where I can have different query strings per row which is driven by queries loaded into a config table. I have it worked out how to load and retrieve a query string such as above from a separate config table via:
queryFilter = from(bucket: “bucket1”)
|> range(start: -99y)
|> filter(fn: (r) =>
r._measurement == “config” and
r.var_name == “$grafana_var_name”
)
|> last(column: “_value”)
|> tableFind(fn: (key) => key._field == “query_filter”)
|> getColumn(column: “_value”)

The query string is now properly represented within queryFilter[0].

What happens if I try to execute the above I get the error:
type error @25:6-25:44: expected bool but found string for return type (argument fn)
because the Flux language expects to interpret the contents directly.
If there was a way to do this, this solution would solve a problem which I have seem many people post about which is the ability to dynamically change the queries in repeating panels (or rows of panels) in Grafana by using a configuration driven model. If there was a way to do this one thing that entire solution would work.
Anyone have any thoughts on how to do this?

Thanks,
Kelby

Have you found a solution for this? I’m facing a similar problem.