Modifying option in flux query?

here is the final step that works

origin multi select variable is generated like this

import “influxdata/influxdb/v1”
v1.tagValues(
bucket: v.bucket,
tag: “origin”,
predicate: (r) => true,
start: -1d
)

destination multi select variable is generated like this

import “influxdata/influxdb/v1”
v1.tagValues(
bucket: v.bucket,
tag: “destination”,
predicate: (r) => true,
start: -1d
)

the query that allows displaying only what is selected in the origin and destination variables is this one (big thanks to this post and its contributors → Grafana + InfluxDB Flux - query for displaying multi-select variable inputs - #7 by martinfalch)

from(bucket: “simdataset”)
|> range(start: -4d)
|> filter(fn: (r) => r[“_measurement”] == “$measurement”)
|> filter(fn: (r) => r[“_field”] == “waitingTime”)
|> filter(fn: (r) => contains(value: r[“origin”], set: ${origin:json}))
|> filter(fn: (r) => contains(value: r[“destination”], set: ${destination:json}))
|> yield(name: “last”)