Using stream variables

Im using flux 0.24 with Influx 1.7 and I enabled flux, and ran a simple query from the influx CLI.

This works fine and my data returns, here is the query:
from(bucket:"test") |> range(start: -3d) |> filter(fn: (r) => r._measurement == "CustomMetrics" and r.metrics_string == "Organizations")

Next I read the docs on how to join data, via: https://docs.influxdata.com/flux/v0.24/guides/join/ and it says In order to perform a join, you must have two streams of data. Assign a variable to each data stream.

so I simply added a variable
OrgResults = from(bucket:"test") |> range(start: -3d) |> filter(fn: (r) => r._measurement == "CustomMetrics" and r.metrics_string == "Organizations")

And when I try and run that query, I get back a nil tag. I’ve tried adding a yield, but the results are always the same. Im not sure what Im doing wrong, or how I can “see” what the variable OrgResults has in it.

Any pointers/guidance is appreciated.

Hi @taylor , welcome !

If you add OrgResults at the end of your script you can see the content …
to join you will have to add the join function …

best regards

 OrgResults = from(bucket:"test") 
|> range(start: -3d) 
|> filter(fn: (r) => r._measurement == "CustomMetrics" and r.metrics_string == "Organizations")
OrgResults
1 Like

Thanks much @MarcV, that worked.