I'm working on a SolarWinds Modern Dashboard, version 2026.2.1, where the widget is to track the licenses that we have on site. My goal now is to make sure that when the current date cross the 90 days to reach the expiry date, the status automatically change to Renewal. Currently it is being done manually by me, changing the information data inside the node custom properties itself.
Is there a way to move away from changing the status field manually and making it change to Renewal if the status is active and it has less than 90 days to reach the expiry date?
The code is currently working and like this:
SELECT
n.Caption AS NodeName,
ncp.License_Product,
ncp.License_Name,
-- keep for sorting only (do not display this column)
ncp.License_Expiry AS License_Expiry_Sort,
-- display as string (DD-MM-YYYY)
Concat(
CASE WHEN Day(ncp.License_Expiry) < 10
THEN Concat('0', ToString(Day(ncp.License_Expiry)))
ELSE ToString(Day(ncp.License_Expiry)) END,
'-',
CASE WHEN Month(ncp.License_Expiry) < 10
THEN Concat('0', ToString(Month(ncp.License_Expiry)))
ELSE ToString(Month(ncp.License_Expiry)) END,
'-',
ToString(Year(ncp.License_Expiry))
) AS ExpiryDateText,
ncp.License_Owner,
ncp.License_Status
FROM Orion.Nodes n
JOIN Orion.NodesCustomProperties ncp ON n.NodeID = ncp.NodeID
WHERE ncp.License_Expiry IS NOT NULL
ORDER BY License_Expiry_Sort ASC
I tried using date functions such as GetDate() and DayDiff(), which supposedly would allow me to calculate the number of days remaining before the license expiry date, but it didn't work:
SELECT
n.Caption AS NodeName,
ncp.License_Product,
ncp.License_Name,
ncp.License_Expiry AS License_Expiry_Sort,
Concat(
CASE WHEN Day(ncp.License_Expiry) < 10
THEN Concat('0', ToString(Day(ncp.License_Expiry)))
ELSE ToString(Day(ncp.License_Expiry)) END,
'-',
CASE WHEN Month(ncp.License_Expiry) < 10
THEN Concat('0', ToString(Month(ncp.License_Expiry)))
ELSE ToString(Month(ncp.License_Expiry)) END,
'-',
ToString(Year(ncp.License_Expiry))
) AS ExpiryDateText,
ncp.License_Owner,
CASE
WHEN ncp.License_Status = 'Active'
AND DayDiff(GetDate(), ncp.License_Expiry) <= 90
AND DayDiff(GetDate(), ncp.License_Expiry) >= 0
THEN 'Renewal'
WHEN DayDiff(GetDate(), ncp.License_Expiry) < 0
THEN 'Expired'
ELSE ncp.License_Status
END AS License_Status
FROM Orion.Nodes n
JOIN Orion.NodesCustomProperties ncp
ON n.NodeID = ncp.NodeID
WHERE ncp.License_Expiry IS NOT NULL
ORDER BY License_Expiry_Sort ASC
always getting the error "no viable alternative at input 'ncp' in Select clause" :/
anyone has any idea how I can achieve my goal to have the status automated without change the whole widget structure?
Thanks a lot!