diff --git a/MDX2JSON/Utils.cls b/MDX2JSON/Utils.cls index 0f054a5..88201d1 100644 --- a/MDX2JSON/Utils.cls +++ b/MDX2JSON/Utils.cls @@ -53,6 +53,11 @@ ClassMethod ExecuteResultSet(RS As MDX2JSON.ResultSet, QueryKey As %String = "", quit Status } +ClassMethod QuerySet(MDX) As %Status +{ + set ^Query($I(^Query), "%dsQuery") = MDX +} + /// Automatic processing of MDX query and outputting resulting JSON.
/// MDX - String containing MDX query.
ClassMethod WriteJSONfromMDX(MDX As %String, Timeout As %Integer = 0) As %Status @@ -76,6 +81,17 @@ ClassMethod WriteJSONfromMDX(MDX As %String, Timeout As %Integer = 0) As %Status set obj = RS.ToProxyObject(.tSC) return:$$$ISERR(tSC) tSC + + set %dsQuery = MDX + + // initiate an RS object to a global variable %dsResultSet + set %dsResultSet = RS + + set %dsCubeName = RS.%Cube + + // check if audit global hold something and execute it + try {xecute ^DeepSee.AuditQueryCode} catch {} + $$$DynObjToJSON(obj) }else{ // if cube is not compound execute the query in usual way @@ -85,8 +101,17 @@ ClassMethod WriteJSONfromMDX(MDX As %String, Timeout As %Integer = 0) As %Status set obj = RS.ToProxyObject(.tSC) return:$$$ISERR(tSC) tSC + + set %dsQuery = MDX + set %dsResultSet = RS + + // check if audit global hold something and execute it + try {xecute ^DeepSee.AuditQueryCode} catch {} + $$$DynObjToJSON(obj) } + + return $$$OK } @@ -108,7 +133,6 @@ ClassMethod WriteJSONfromQuery(CubeKey As %String, QueryKey As %String, Timeout return $$$OK } - /// Execute SQL query taken from KPI and extract column values by name of column /// Output array with list of values like so pValue(n) = $LB(sNameList(i)...) ClassMethod GetSQLValues(pSQL, Output pValues As %String, Output tResultSet As %SQL.Statement) As %Status @@ -133,7 +157,6 @@ ClassMethod GetSQLValues(pSQL, Output pValues As %String, Output tResultSet As % return st } - /// This method provides listing execution for KPI. /// tKPI as a name of KPI class. pFilters not yet implemented /// as a pSelection. Thats for future use. @@ -309,7 +332,7 @@ ClassMethod GetDataSource(pDataSource As %String) set st = $$$OK try { - + if ($FIND(pDataSource, ".pivot") = ($LENGTH(pDataSource) + 1) && pDataSource '="") { set st = ..OpenPivotByName(pDataSource, .dataSource) return:($$$ISERR(st)) st @@ -322,6 +345,7 @@ ClassMethod GetDataSource(pDataSource As %String) set st = ##class(%ZEN.Auxiliary.jsonProvider).%ObjectToJSON(dataSource, .out) } + } catch ex { set st = ex.AsStatus() @@ -409,12 +433,19 @@ ClassMethod GetWidgetsList(pDashName As %String) As %Status ClassMethod GetDashboard(pDashName As %String) As %Status { try { + set st = ##class(MDX2JSON.DashboardFilters).OpenDashboardByName(pDashName, .dash) return:($$$ISERR(st)) st set st = ##class(MDX2JSON.DashboardFilters).WidgetsToProxyObject(dash, .widgetlist) return:($$$ISERR(st)) st w "" // weird hack required for 15.3 + + set %dsDashboard = pDashName + + // check if audit global hold something and execute it + try {xecute ^DeepSee.AuditCode} catch {} + $$$DynObjToJSON(widgetlist) } catch ex { set st = ex.AsStatus() @@ -423,6 +454,42 @@ ClassMethod GetDashboard(pDashName As %String) As %Status return st } +/// the method initiate the audit for %dsDashboard +ClassMethod SetAuditCode() As %Status +{ + set ^DeepSee.AuditCode = "Do ##class(MDX2JSON.Utils).SetAuditDash()" + + quit $$$OK +} + +/// the method initiate the audit for %dsQueryText, %dsCubeName, %dsResultSet +ClassMethod SetAuditQueryCode() As %Status +{ + set ^DeepSee.AuditQueryCode = "Do ##class(MDX2JSON.Utils).SetAuditQuery()" + + quit $$$OK +} + +/// zw ^AuditLogDash to get the dashboard audit dashboard readings +ClassMethod SetAuditDash() As %Status +{ + set ^AuditLogDash($INCREMENT(^AuditLogDash),"%dsDashoard") = %dsDashboard + + quit $$$OK +} + +/// zw ^AuditLogQuery to get the query audit readings +/// zw ^AuditLogCube to get the cube audit readings +/// zw ^AuditLogRS to get the RS audit readings +ClassMethod SetAuditQuery() As %Status +{ + set ^AuditLogQuery($INCREMENT(^AuditLogQuery),"%dsQueryText") = %dsQueryText + set ^AuditLogCube($INCREMENT(^AuditLogQuery),"%dsCubeName") = %dsCubeName + set ^AuditLogRS($INCREMENT(^AuditLogRS),"%dsResultSet") = %dsResultSet + + quit $$$OK +} + /// Get format defaults. ClassMethod GetFormat() As %Status { @@ -672,7 +739,6 @@ ClassMethod DeleteWidget(wName As %String, sDashboard As %String) As %Status return st } - /// the collection of necessary parameters for building widget ClassMethod UpdateWidget(widgetToUpdate As %DeepSee.Dashboard.Widget, data As %ZEN.proxyObject) As %Status {