I am trying to use CONVERT in SWQL studio and am getting this error:
"Cannot resolve property Float"
Now, the SDK documentation does not list CONVERT or CAST as available functions, but SWQL studio gives this error when using ROUND -
"Implicit conversion from data type datetime to float is not allowed. Use the CONVERT function to run this query." suggesting, at least to me, that I should use CONVERT.
Here is the SQL from the window in SWQL Studio:
SELECT TOP 10
HOUR(CPULoad.DateTime) AS Hour,
MINUTE(CPULoad.DateTime) AS MINUTE,
SECOND(CPULoad.DateTime) AS SECOND,
MILLISECOND(CPULoad.DateTime) AS mS,
DATETRUNC('minute', CPULoad.DateTime) as DateTrunc,
--CONVERT(Float,CPULoad.DateTime),
ROUND(DateTime,4) AS Round,
CPULoad.DateTime
FROM Orion.CPULoad
What I would like is to round the DateTime to the nearest minute in a SWIS query to pass the data to a display package.
The SQL generated by the Orion Report writer does it like this:
| SELECT TOP 10000 Convert(DateTime,Floor(Cast((DateTime) as Float)*24)/24,0) AS SummaryDateTime, |
| Nodes.SysName AS System_Name, |
| AVG(CPULoad.AvgLoad) AS AVERAGE_of_AvgCPULoad, |
| MIN(CPULoad.MinLoad) AS MIN_of_MinCPULoad, |
| MAX(CPULoad.MaxLoad) AS MAX_of_MaxCPULoad |
| FROM |
| Nodes INNER JOIN CPULoad ON (Nodes.NodeID = CPULoad.NodeID) |
| WHERE |
| ( DateTime BETWEEN 42260.5 AND 42260.625 ) |
| AND |
| ( |
| (Nodes.SysName LIKE 'phlprlxsyboltp00%') |
| ) |
| GROUP BY Convert(DateTime,Floor(Cast((DateTime) as Float)*24)/24,0), |
| Nodes.SysName |
| ORDER BY SummaryDateTime ASC |
But it seems that this method is not available in SWIS?
SWQL Studio is 1.10.16.0
Attachement contains screenshots from SWQL studio.