@lrose @pturmel
First off, I am so sorry!
After both of these edits, this is the error I get. I’ll embed the codes down below.
I’ll give context to as much as I can. There is an “all spirals” button that sets a property to “Spiral 0”. Also 3 more that set it to “Spiral 1”, “Spiral 2”, “Spiral 3”. When the property is “Spiral 0”, a new graph with it’s own query, multistate, and database becomes visible. When the property is not “Spiral 0”, the original bar graph with the original query, multistate, and database is visible.
I get this error for all 3 spirals when I add the multistate displaypath script to the new and original multistate.
This is the error I get if I only add the multistate displaypath script to the new multistate.
The new multistate script for “Spiral 0” graph as suggested by @lrose.
switch({Alarm Analysis (1).dbType},
"MYSQL", "MSSQL", "POSTGRES",
switch({Alarm Analysis (1).Alarms By Selection.Selection.controlValue},
0, 1, 2,
"DATE_FORMAT(a.eventtime, '%W')+(a.displaypath)",
"DAY(a.eventtime)+(a.displaypath)",
"HOUR(a.eventtime)+(a.displaypath)",
"HOUR(a.eventtime)+(a.displaypath)"),
switch({Alarm Analysis (1).Alarms By Selection.Selection.controlValue},
0, 1, 2,
"DATENAME(DW, a.eventtime)+(a.displaypath)",
"DATEPART(DAY, a.eventtime)+(a.displaypath)",
"DATEPART(HOUR, a.eventtime)+(a.displaypath)",
"DATEPART(HOUR, a.eventtime)+(a.displaypath)"),
switch({Alarm Analysis (1).Alarms By Selection.Selection.controlValue},
0, 1, 2,
"EXTRACT(DOW FROM a.eventtime)+(a.displaypath)",
"EXTRACT(DAY FROM a.eventtime)+(a.displaypath)",
"EXTRACT(HOUR FROM a.eventtime)+(a.displaypath)",
"EXTRACT(HOUR FROM a.eventtime)+(a.displaypath)"),
"")
The final property using stringFormat as suggested by @pturmel.
stringFormat("%s, %s, %s", {Root Container.Alarm Analysis (1).spiral_id_data_extra_1}, {Root Container.Alarm Analysis (1).spiral_id_data_extra_2}, {Root Container.Alarm Analysis (1).spiral_id_data_extra_3})
This is the original query for the graph for one individual spiral at a time. I believe the error is referring to this query
switch({Alarm Analysis (1).dbType},
"MYSQL", "MSSQL", "POSTGRES",
"SELECT " +
{Alarm Analysis (1).Alarms By Selection 1.Selection.groupBy} + " label, " +
" COUNT(*) alarms " +
"FROM " +
" alarm_events a " +
" LEFT JOIN alarm_events c ON c.eventid = a.eventid AND c.eventtype = 1 " +
"WHERE " +
" a.eventtime " +
" BETWEEN '" + dateFormat({Alarm Analysis (1).startDate}, "yyyy-MM-dd HH:mm:ss") + "' AND '" + dateFormat({Alarm Analysis (1).endDate}, "yyyy-MM-dd HH:mm:ss") + "' " +
" AND a.eventtype = 0 " +
" AND a.displaypath = '" + escapeSQL({Alarm Analysis (1).spiral_id_data}) + "' " +
"GROUP BY " +
" " + {Alarm Analysis (1).Alarms By Selection.Selection.groupBy} + " " +
"ORDER BY " +
" " + {Alarm Analysis (1).Alarms By Selection.Selection.groupBy} + " ASC",
"SELECT " +
{Alarm Analysis (1).Alarms By Selection 1.Selection.groupBy} + " label, " +
" COUNT(*) alarms " +
"FROM " +
" alarm_events a " +
" LEFT JOIN alarm_events c ON c.eventid = a.eventid AND c.eventtype = 1 " +
"WHERE " +
" a.eventtime " +
" BETWEEN '" + dateFormat({Alarm Analysis (1).startDate}, "yyyy-MM-dd HH:mm:ss") + "' AND '" + dateFormat({Alarm Analysis (1).endDate}, "yyyy-MM-dd HH:mm:ss") + "' " +
" AND a.eventtype = 0 " +
" AND a.displaypath = '" + escapeSQL({Alarm Analysis (1).spiral_id_data}) + "' " +
"GROUP BY " +
" " + {Alarm Analysis (1).Alarms By Selection.Selection.groupBy} + " " +
"ORDER BY " +
" " + {Alarm Analysis (1).Alarms By Selection.Selection.groupBy} + " ASC",
"SELECT " +
{Alarm Analysis (1).Alarms By Selection 1.Selection.groupBy} + " AS label, " +
" COUNT(*) alarms " +
"FROM " +
" alarm_events a " +
" LEFT JOIN alarm_events c ON c.eventid = a.eventid AND c.eventtype = 1 " +
"WHERE " +
" a.eventtime " +
" BETWEEN '" + dateFormat({Alarm Analysis (1).startDate}, "yyyy-MM-dd HH:mm:ss") + "' AND '" + dateFormat({Alarm Analysis (1).endDate}, "yyyy-MM-dd HH:mm:ss") + "' " +
" AND a.eventtype = 0 " +
" AND a.displaypath = '" + escapeSQL({Alarm Analysis (1).spiral_id_data}) + "' " +
"GROUP BY " +
" " + {Alarm Analysis (1).Alarms By Selection.Selection.groupBy} + " " +
"ORDER BY " +
" " + {Alarm Analysis (1).Alarms By Selection.Selection.groupBy} + " ASC",
"SELECT 1")```