Hello I'm new to scripting and I'm trying to get the latest IP SLA statistics of a pair of devices. I'm able to get them without an issue however there are times that I'm getting NULL values as result which messes up my script. I need to get non-Null values for both Device1 and Device2 so I can compare them and make a decision based of their results.
If I add a WHERE <column> IS NOT NULL, I could get only 1 result or non at all if there's a NULL value at the time of query which is the problem, i need to get result for both device1 and device2. Is there a way to re-run my queries until the value is not NULL or optimize my queries so that I could get the last non-NULL value inserted of the table? I'm hoping this can be done on the SWQL queries before I pass the result to my script.
Thanks in advanced.
Here's my sample script:
SELECT OperationInstanceID, RoundTripTime, Latency, Jitter, PacketLoss
FROM Orion.IpSla.OperationCurrentStats
WHERE RecordTime >= ADDDATE('SECOND', -30, GETDATE()) AND OperationInstanceID = '1' OR OperationInstanceID = '2'
| OperationInstanceID | RoundTripTime | Latency | Jitter | PacketLoss |
| 1 | 8 | 8.10000038146973 | 1 | 0 |
| 2 | 2 | NULL | NULL | NULL |