Skip to main content
How Can We Help?

Search for answers or browse our knowledge base.

External Data Query Default

You are here:
< Back

This script is located in tblSystemParameters in the WTRecordSource row. The results can be accessed from Asset -> External Data Query

SELECT [PortID],Description, (select count(*) from tblnodemaster where portid=a.portid and enabled=1) as 'Enabled Nodes', (select count(*) from tblnodemaster where portid=a.portid and enabled=1 and DATEDIFF(Day, LastGoodScanTime, getdate() )>60) as 'Enabled NoCom>60D', (select max(LastGoodScanTime) from tblnodemaster where portid=a.portid) as 'LastScan',(select DATEDIFF(MINUTE, max(LastGoodScanTime), getdate()) from tblnodemaster where enabled=1 and portid=a.portid) as 'Minutes Since Last Good Scan', (select count(*) from tbltransactions where portid=a.portid and dateprocess is null) as 'In Queue',[CommConsecFails] as 'ConsecFails',(select count(*) from tbltransactions where portid=a.portid and result IN ('OK', '') and DATEDIFF(Day, dateprocess, getdate() ) <= 0) as 'Success', (select count(*) from tbltransactions where portid=a.portid and result in ('Timeout','CRC Error','SocketConnectFail','SockError','VP Err') and DATEDIFF(Day, dateprocess, getdate() ) <= 0) as 'Fails', str(((select count(*) from tbltransactions where portid=a.portid and result in ('OK','') and DATEDIFF(Day, dateprocess, getdate() ) <= 0))/((select count(*) from tbltransactions where portid=a.portid and DATEDIFF(Day, dateprocess, getdate() ) <= 0 and DateProcess IS NOT NULL and [Result] IN ('OK','Timeout','CRC Error','SocketConnectFail','SockError','VP Err',NULL,''))+0.01)*100,6,1) as '%SuccessToday', (select AVG(PctCommYest) from tblNodemaster where portid=a.portid and enabled = 1) as '%SuccessYest',(select count(*) from tbltransactions where portid=a.portid and result='CRC Error' and DATEDIFF(Day, dateprocess, getdate() ) <= 0) as 'CRC Errors', (select count(*) from tbltransactions where portid=a.portid and result='Timeout' and DATEDIFF(Day, dateprocess, getdate() ) <= 0) as 'Timeouts', (select count(*) from tbltransactions where portid=a.portid and result IN ('SocketConnectFail','SockError','VP Err') and DATEDIFF(Day, dateprocess, getdate() ) <= 0) as 'SocketConnectFails' FROM tblPortMaster a where a.enabled=1 order by portid