Quantcast
Channel: THWACK: All Content - Orion SDK
Viewing all articles
Browse latest Browse all 2677

SWQL Date Calcuations right?

$
0
0

I have been working with the following SWQL query and someone pointed out that the duration was wrong.

 

We had some nodes that were unmanaged from 6/1/17 until 8/1/17 but the duration said it was 41 days. Clearly this was not correct. I then tried it on another node and that duration was not correct either.

 

Is there something I am missing as for how the date calculations work in SWQL?

 

 

SELECT '' as n, '/Orion/images/StatusIcons/Small-' + tostring(N.StatusIcon)  AS [_IconFor_n], N.detailsurl as [_linkfor_Caption],

N.Caption, N.UnManageFrom AS [From], N.UnManageUntil AS [Until], AE.AccountID AS [By], DayDiff(GetUtcDate(), N.UnmanageUntil) AS [Days Left]

FROM Orion.Nodes N JOIN Orion.AuditingEvents AE ON (AE.NetObjectID = N.NodeID)

WHERE N.UnManaged = 1 AND (AE.AuditEventID  = (SELECT TOP 1 AE2.AuditEventID FROM Orion.AuditingEvents AE2 WHERE AE2.NetObjectID = N.NodeID ORDER BY AE2.TimeLoggedUtc DESC))

ORDER BY N.Caption


Viewing all articles
Browse latest Browse all 2677

Trending Articles