I have SWQL code that creates a table from two UnDP with an output of a percentage. The RawStatusRatio and the the SecondAssignment is what I need in an email for alerting purposes. The original SWQL for both the table and the Alert Condition itself seems to not have an issue but I cannot get the table to display in the email action. At worst I would be willing to get the two requirements (RawStatusRatio and the the SecondAssignment) but I'm trying to get the information from the code itself.
Eventually I would like to use the ${NodeID} variable so I can associate with multiple devices but that is for another day.
SELECT
a.NodeID,
a.AssignmentName AS FirstAssignment,
a.RawStatus AS FirstRawStatus,
b.AssignmentName AS SecondAssignment,
b.RawStatus AS SecondRawStatus,
(a.RawStatus * 1.0 / b.RawStatus) AS Percentage
FROM Orion.NPM.CustomPollerStatusOnNode a
JOIN Orion.NPM.CustomPollerStatusOnNode b
ON a.NodeID = b.NodeID
AND a.AssignmentName < b.AssignmentName -- Ensures distinct assignments for comparison
WHERE a.NodeID = '18656'
AND a.AssignmentName LIKE 'fw%'
AND b.AssignmentName LIKE 'fw%'
ORDER BY a.AssignmentName, b.AssignmentName;
In turn, I have created an SWQL alert where the Trigger Condition works. I can show that it triggers when the condition is below 6% but does not above 6%. I get the email and log message.

The issue that I have is that I believe I should be able to add the SWQL/SQL code in the email message, delayed by 5 minutes, but it keeps returning the code itself. I've had no issue using variables in other alerts but this one is stumping me. Changing it from SQL to SWQL seems to have the same issue.
${N=SQL;M=SELECT
a.NodeID,
a.AssignmentName AS FirstAssignment,
a.RawStatus AS FirstRawStatus,
b.AssignmentName AS SecondAssignment,
b.RawStatus AS SecondRawStatus,
(a.RawStatus * 1.0 / b.RawStatus) AS RawStatusRatio
FROM Orion.NPM.CustomPollerStatusOnNode a
JOIN Orion.NPM.CustomPollerStatusOnNode b
ON a.NodeID = b.NodeID
AND a.AssignmentName < b.AssignmentName -- Ensures distinct assignments for comparison
WHERE a.NodeID = '18656'
AND a.AssignmentName LIKE 'fw%'
AND b.AssignmentName LIKE 'fw%'
ORDER BY a.AssignmentName, b.AssignmentName;}
Any help would be greatly appreciated. I will also upload the alert and documentation once I get this last part working.
Thank you,