What are the limitations and pitfalls of showing SQL Reports from Orion Report Writer in Views where Limitations are applied?
----------
I have several different Views that I used for reporting weekly performance for different groups in our network.
The views would include a Custom Network Wide Graph for the Last 7 Days and then my associated Report from Orion Report Writer (custom SQL report). A True/False limitation on a custom property is applied to the view so that the graph represents my desired group (IsOPSGear = 1).
I found before that the report fails if it does not already meet the limitation.
The original SQL report I created shows our Top 20 worst performing Sites according to Average Availability and Packet Loss from ResponseTime_Detail (e.i. last 7 days). Note that Nodes.IsOPSGear = 1 is the same limitation I apply to my View. This SQL report has worked fine
====ORIGINAL====
SELECT TOP (20) AVG(TempTable.AvgAvail) AS NodeAvail, AVG(TempTable.AvgLoss) AS PacketLoss, Nodes.Department, Nodes.Site, Nodes.City
FROM (SELECT NodeID, AVG(Availability) AS AvgAvail, AVG(PercentLoss) AS AvgLoss, YEAR(DateTime) AS YearDate, MONTH(DateTime) AS MonthDate,
DAY(DateTime) AS DayDate
FROM ResponseTime_Detail
GROUP BY YEAR(DateTime), MONTH(DateTime), DAY(DateTime), NodeID
) AS TempTable LEFT OUTER JOIN
Nodes ON TempTable.NodeID = Nodes.NodeID
WHERE (Nodes.IsOPSGear = 1)
GROUP BY Nodes.Site, Nodes.City, Nodes.Department
ORDER BY NodeAvail, PacketLoss DESC, Nodes.Department, Nodes.Site, Nodes.City
===============
The above SQL worked for showing the Last 7 Days when ResponseTime_Detail was set for 7 Days. We have since changed this to 30 Days. Therefore an additional line was required in my SQL report to select only the Last 7 Days [WHERE (DateTime > { fn NOW() } - { fn CURTIME() } - 7)].
The SQL Report with the added line runs successfully in the View when no Limitations are applied. When the Limitation IsOPSGear=1 is applied to the View the report produces the following error. I have been unable to resolve this annoyance and I don't know why this does not work. How does the View Limitation get applied to the Report? Why is it causing the Report to fail?
====ERROR====
System.Data.SqlClient.SqlException: The multi-part identifier "Nodes.IsOPSGear" could not be bound. at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) at
...
============
====ORIGINAL====
SELECT TOP (20) AVG(TempTable.AvgAvail) AS NodeAvail, AVG(TempTable.AvgLoss) AS PacketLoss, Nodes.Department, Nodes.Site, Nodes.City
FROM (SELECT NodeID, AVG(Availability) AS AvgAvail, AVG(PercentLoss) AS AvgLoss, YEAR(DateTime) AS YearDate, MONTH(DateTime) AS MonthDate,
DAY(DateTime) AS DayDate
FROM ResponseTime_Detail
WHERE (DateTime > { fn NOW() } - { fn CURTIME() } - 7)
GROUP BY YEAR(DateTime), MONTH(DateTime), DAY(DateTime), NodeID
) AS TempTable LEFT OUTER JOIN
Nodes ON TempTable.NodeID = Nodes.NodeID
WHERE (Nodes.IsOPSGear = 1)
GROUP BY Nodes.Site, Nodes.City, Nodes.Department
ORDER BY NodeAvail, PacketLoss DESC, Nodes.Department, Nodes.Site, Nodes.City
===============