Condition logic `or` in filter function

Hi. I have a flux query that has several ‘or’ conditions in a filter function. It’s something like this.

from(bucket: "my_buck")
  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)
  |> filter(fn: (r) => r["_measurement"] == "my_measurement")
  |> filter(fn: (r) => r["idDispositivo"] == "155" or r["idDispositivo"] == "150") 
  |> aggregateWindow(every: 1h, fn: mean, createEmpty: false)
  |> yield(name: "mean")

The example has only one ‘or’ but in the real query there can be several and the query would also be created dynamically. Is there a way to change

 |> filter(fn: (r) => r["idDispositivo"] == "155" or r["idDispositivo"] == "150") 

for something like

 |> filter(fn: (r) => r["idDispositivo"] in ["155", "150"]) 

I know that this syntax is not correct, but ask if there is something similar that allows me to make the dynamic query easier without having to use so many ‘or’

Thanks in advance

Hello @raidel,
Unfortunately Flux doesn’t support in.
I know using many or is cumbersome. You can also use != if that helps.

I asked this question on stackoverflow and they gave me a solution. I share it here.