looking at the way I have defined the variables, and comparing to the charts, in the drop downs for loadername and truckname there is only 1 drop down at the top of the page for selecting loader and truck, and the only option is to set an individual or “all”, and I have selected all. So in a way its doing what it is supposed to, although not what I want it to do. One solution I could think of is not to have repeating rows, but to define an individual row for each loader, but then I would have to have individual queries for each row, which is messy
If a truck is not assigned to a loader, the fact that there is a viz for that combo is misleading at least to me
I agree, but is there any way around it?
No that I know of personally maybe others might chime in
I even redid your schema design to be normalized with
Trucks
Loaders
Production
tables but issue persists
Thanks very much for the help. It might be something I can do better with the new scenes functionality.
Going to try it in mysql
Ok thanks. the data in MSSQL is actually only for testing, I’ll be using prometheus for the live version.
why would you use a monitoring system for this? sledge hammer for sewing a bathcloth
what I’ve shown you here is just a prototype, proof of concept, there will be a lot more added later
Have you tried defining the variables differently?
I mean if the LoaderName is the main criteria, try this:
LoaderName : select distinct loaderName from ttruckProduction
TruckName : select distinct deviceName from ttruckProduction where loaderName = $LoaderName
Then in your panels choose repeat by $LoaderName, have the $TruckName set to allow ALL and select it as ALL.
Play around this idea, eventually including rows and set them to repeat by $LoaderName.
Maybe in your query you could keep just the “where deviceName = $TruckName” condition
Hi, thanks for the reply. I did try a query like that for loader, and I was thinking along the same lines as your suggestion, but I didn’t change the repeat method. I’ll play around with it.
Is there anywhere in the doco that describes the interaction between queries and variables, the sequencing, how they are pulled and how they are used and interpreted? I’m thinking that what I’m trying to do isn’t that complicated, but because I’m only guessing at how these mechanisms work its a lot more difficult than it should be.
Is the database query run only once to produce an entire dataset from which each panel selects its data, or does each panel create its own query based on the dbquery+variables and then each query is run separately?
Also note that in the variables documentation where it gives links to chart examples, all those links are broken.
Still not getting anywhere, I’ve tried many different combinations and orderings of the above suggestions, but they all result in either a syntax error or no data, or each row having the same data.
My current settings result in the error “db query error : mssql : syntax error near ‘,’.”
Settings are -
variables -
LoaderName : select distinct loaderName from ttruckProduction||||||
TruckName : select distinct deviceName from ttruckProduction where loaderName = $LoaderName
both variables are set to “allow all”
db query -
SELECT startTime as time, cycleProdRateBCM, deviceName, loaderName FROM PitOps.dbo.tTruckProduction
where loaderName in ($LoaderName)
and deviceName = $TruckName
order by startTime desc
Have you tried to create a variable as a concat of the two fields and then condition your query on that variable? Haven’t tried it myself but maybe it could work.
The first suggestion I gave was based on something similar but i was actually checking different tables (row repeat by table, panel repeat by value/column in the table - and each table had the same column structure), so not quite what you need (different columns in same table)
LE: i just tried this on one of my tables, seems to get some data, now see if it works for you to bring you the data you need
var definition: variableName – select distinct concat(loaderName, deviceName) from your_table where startTime between x and y
- use time filtering here otherwise it will bring you aaaaalll of your history (if you filter in your panel query it’s too late, the variable will have all values from the table)
panel query:
select your_columns
from your_table
where concat(loaderName, deviceName) = $variableName
repeat option by variable $variableName
Good luck and hope this helps
Hi thanks for the reply, I havent tried it yet but will shortly. I take it that you mean repeat my panels by $variableName, but how do I repeat the rows? If I only have one combined variable then I only have one thing to repeat on?
Var would be
Truck 101 - Loader 1
Truck 102 - Loader 1
Etc
thats the variable repeat for panels, correct? what would be the variable to repeat the rows on?
I have this now, closer but still not right (just hardcoded the time for now, that can be adjusted later) -
variables -
LoaderName : select distinct loaderName from ftruckProduction
where startTime>=‘2023-07-11 20:00’
LoaderTruck : select distinct concat(loaderName, deviceName) from ftruckProduction where startTime>=‘2023-07-11 20:00’
and loaderName = ${LoaderName}
panel query : SELECT startTime as time, cycleProdRateBCM, deviceName, loaderName FROM PitOps.dbo.fTruckProduction
where concat(loaderName, deviceName) = ${LoaderTruck}
and startTime>=‘2023-07-11 20:00’
order by startTime asc
panel repeat on $LoaderTruck
row repeat on $LoaderName
Now there are no “no data” panels which is a step in the right direction, but what happens now is that every row shows the data for only the first loader and every row is the same. Even though the dropdown for each row is a different loaderName, the panels all show the same data
How did you configure the repeat setting? My telepathic powers are low today
panel repeat on $LoaderTruck
row repeat on $LoaderName
or do you mean something else?
@willwaterston
No, in this case you no longer need rows repeated, just panels repeated.
it is different from what i suggested first time.
you now repeat panels by a variable that contains both Loader and Device (btw, you can name your panel as $variableName) and then you can see the combinations on the name of the panel.
@yosiasz The repeat settings are in the panel edit mode, there is a point on the right-side menu, Repeat Options. Usually this setting is not expanded at first, you need to click on it.