Hello, need help … this simple query fails (no plot on the time series panel) when $origin is set to “3” … because of bad option usage (not using variable as they are immutable), but I don’t know how to solve it … can you help? it works when $origin is set to “1” or “2”.
$origin can be selected from “1”,“2”,“3”
$destination is constant = “3”
but, now, what if I want $origin to cover a range from 0 to 3 … something like this
…
|> filter(fn: (r) =>
(r[“origin”] == “0” and r[“destination”] == lv_destination)) or
(r[“origin”] == “1” and r[“destination”] == lv_destination)) or
(r[“origin”] == “2” and r[“destination”] == lv_destination)) or
(r[“origin”] == “3” and r[“destination”] == lv_destination))
…
how to implement a loop over all $origin values instead of having the repetition (mainly because I don’t know a “priori” how many values I have in the $origin range)
Right now it is string because I think this is the way it is stored in the influxdb.
But functionally speaking, origin represents the identification of a location, this identification could be A, B or C (instead of 0, 1, 2, 3) hence string seems more appropriate.
destination is also the identification of a location, and therefore I’m interested in the path from A → B, A → C, B → A … but not A → A or B-> B and C → C.
yes, I’m newbee in Grafana and flux language … and I agree perhaps I’m not taking the right way, even the right way to think about the problem …
at the end instead of A, B, C and D, I’ll probably have names in the data base like “Pittsburgh”, “Houston”, “Dallas”, “Miami”.
This is the reason why I’m wondering if I can build a query iterating over several values …
While writing these lines, I’m thinking that those names comes from the database, one column for the origin and one column for the destination … would it be easier, perhaps, to directly play with the columns …
Then explain your task in terms of requirements first. If you think implementation first it could shoe horn you into something you will need to back out of. Forget the code and tell us what you want to do in plain English what are you trying to solve. Then the solution, irregardless of language used, will come naturally
Well here is the description with my best english or “frenglish”
I have a network of N stations called “Pittsburgh”, “Houston”, “Dallas”, “Miami”, …
I simulate 1000 successive random travels from an origin station to a destination station (different from the origin)
for each travel I store the following info in the influxdb:
start time (timestamp)
origin station (tag)
destination station (tag)
trip duration (field)
For each combination “origin-destination” from the database, i want to display the trip duration over the time.
In fact not really for each combination, as I want the user to be able to select one or several or all "origin-destination"combinations to be displayed in the panel