I was previously able to store several queries and then select which one I wanted to visualize by using the yield function.
Past Script
Th1 = from(bucket: "sensors")
|> range(start: dashboardTime)
|> filter(fn: (r) => r._measurement == "Th1" and r._field == "temperature")
|> drop(columns:["_start", "_stop", "_measurement", "position", “_field”])
Th2 = from(bucket: "sensors")
|> range(start: dashboardTime)
|> filter(fn: (r) => r._measurement == "Th2" and r. _field == "temperature")
|> drop(columns:["_start", "_stop", "_measurement", "position", “_field”])
TH = join(tables: {Th1: Th1, Th2: Th2}, on: ["_time"])
|>yield(name: "TH")
I’m having trouble replicating that outcome where only one table is returned. Could it have something to do with having different measurements?
Current Script:
one = from(bucket: "telegraf")
|> filter(fn: (r) => r._measurement == "cpu" and r._field == "usage_system" and r.cpu == "cpu-total")
|> range(start: -5m)
two = from(bucket: "telegraf")
|> filter(fn: (r) => r._measurement == "cpu" and r._field == "usage_system" and r.cpu == "cpu-total")
|> range(start: -3m)
|> yield(name: "2")
Expectation: one table in the Raw Data view. Reality in Raw Data: two tables where table=0 for both. One table with #default=2 and the #default=0. Using 1.7.
Also, as an aside, I would expect to be able to filter by table (in Visualization mode) and search “2” to find my table. Does the yield function only change the name in Raw Data?
Thank you!