26-03-2014 10:06 AM
I have created a Property Matrix Report with the Report Wizard. I have changed the report so it’s not showing attributes but rather it runs a query for each column. The report is working fine and is showing objects as expected.
Is there a way to calculate the number of objects in each cell instead of actually showing the objects?
There is function in property reports that counts the cell object – but since I’m running a Query, it just returns 1
Function IReportGenerator_getAnalysisReport(oRoot, oIAnalysis)
Dim oMatrixFromProperties
set oMatrixFromProperties = oRoot.CurrentEnvironment.GetMacro ("~yiWmTJCN9L21[GAT MatrixFromProperties]")
Dim oGATUtilitiesMacro
set oGATUtilitiesMacro = oRoot.CurrentEnvironment.GetMacro ("~AyeLaJ(A9Pz4[GAT Utilities]")
Dim oMegaUtilitiesMacro
Set oMegaUtilitiesMacro = oRoot.CurrentEnvironment.GetMacro("~2l)pZRjj1X40[MEGA utilities]")
' TODO: Change the content of the two following code templates to display a text before and after the matrix.
Dim sIntroductionText, sConclusionText
sIntroductionText = oMegaUtilitiesMacro.CT (oRoot, "~MpRBjEpBJHrD[Introduction - Application Statistics]")
sConclusionText = oMegaUtilitiesMacro.CT (oRoot, "~bpRBjEpBJDsD[Conclusion - Application Statistics]")
oMatrixFromProperties.bRemoveEmptyColumns = false
oMatrixFromProperties.bRemoveEmptyRows = true
' TODO: To replace the text of an item in the cell by a user-defined item text, remove the comment below.
' If the comment is removed, the macro must implement the hookCellItem function.
' Set oMatrixFromProperties.hookCellItemComponent = MySelf
' TODO: To replace the cell content by a user-defined content, remove the comment below.
' If the comment is removed, the macro must implement the hookCellContent function.
' Set oMatrixFromProperties.hookCellContentComponent = MySelf
ReDim aProperties(8)
'Following is queries extracting information about applications in a Library
aProperties(1) = "~mpRBn2pBJ5tC[All applications in Library]"
aProperties(2) = "~HoRBa3pBJzzC[Applications without Application Code]"
aProperties(3) = "~EpRBf6pBJL5D[Application with Environment Diagram]"
aProperties(4) = "~gnRBS7pBJvBD[Application with Internal Diagram]"
aProperties(5) = "~)oRBeApBJLKD[Application connected to city plan area]"
aProperties(6) = "~PnRBGBpBJTRD[Application connected to Functionality]"
aProperties(7) = "~npRBrBpBJbYD[Application connected to System Used]"
aProperties(8) = "~4oRBLCpBJjfD[Application with Required Artifact]"
IReportGenerator_getAnalysisReport = oMatrixFromProperties.getPropertiesReport (oRoot, oIAnalysis, _
"~IoRBjEpBJ1nD[Library]", aProperties, sIntroductionText, sConclusionText)
End Function
27-03-2014 07:01 PM
Thx - spot on !
27-03-2014 01:10 AM
Hi,
The only way I found so far is to use GetSelection in the Report (see the code below)
The good thing is you can create a hideable table. That means you show the number of objects in the first line, and if you click on the little "+" you get to see the details. (See report result.png attached.)
Downside is that this is not great from a performance perspective.
Hope that helps.
Option Explicit Function IAnalysisReportGenerator_Title(oRoot, oAnalysis, oGenerationContext) IAnalysisReportGenerator_Title = "Show Hide Table Section" End Function Function IReportGenerator_getAnalysisReport(oRoot, oIAnalysis) 'Declaration and assignment of common Variables and Utilities Dim oAnalysisParameter, ocCompositeValues, oIConcept, oCompositeValue Dim oWebiManager, oWebiObjectWrapper, oMegaUtilitiesMacro, oWebiTool Set oMegaUtilitiesMacro = oRoot.CurrentEnvironment.GetMacro("MEGA utilities") Set oWebiManager = oIAnalysis.GenerationContext.oMegaWebInterfaceManager Set oWebiObjectWrapper = oWebiManager.newMWMegaObjectWrapper Set oWebiTool = oWebiManager.newMWToolBox Dim oTable Dim ocProject Dim oProject, oReq, oDep, oObj, oRisk, oSite Dim oSubPro Dim colReq, colDep, colObj, colRisk, colSite Dim strReq, strDep, strObj, strRisk, strPro, strSite, strSubPro, strStd Set ocProject = oWebiTool.createCollection For Each oAnalysisParameter in oIAnalysis.AnalysisParameters Set ocCompositeValues = oIAnalysis.getParameterValues(oAnalysisParameter) For Each oCompositeValue In ocCompositeValues For Each oIConcept In oCompositeValue.IParameterCompositeValue_IConcept Dim omoMegaObject Set omoMegaObject = oIConcept.oConceptManager.getMegaObject(oIConcept.id) ocProject.Add omoMegaObject Next Next Next Set oTable = oWebiManager.newMWShowHideSectionsTable oTable.IShowHideSectionsTable_AddFirstLine 2 oTable.IShowHideSectionsTable_AddContent "Status" oTable.IShowHideSectionsTable_AddContent "Application" oTable.IShowHideSectionsTable_AddContent "Org-Unit" oTable.IShowHideSectionsTable_AddContent "Capability" oTable.IShowHideSectionsTable_AddContent "Standard" oTable.IShowHideSectionsTable_AddContent "Risks" oTable.IShowHideSectionsTable_AddContent "Estimated Cost" dim oEstCost dim boolCost Set oEstcost = oRoot.GetSelection("Select [MetaAttribute] where [Name] 'Estimated Cost'").Item(1) If oEstcost.isAvailable = True then boolCost = 1 end if Set ocProject = oRoot.GetSelection("Select [Project] Where not [Current Project Phase] = '1' and Not [Current Project Status] = 'Completed' And Not [Current Project Status] = 'Rejected' And Not [Current Project Status] = 'Shelved'", "Short Name") 'Main Line For Each oProject in ocProject strPro = oProject.GetProp("Name") Dim ProCost If boolCost = 1 Then ProCost = oProject.GetProp("Estimated Cost") Else ProCost = "N/A" End If 'End if 'Numbers oTable.IShowHideSectionsTable_AddElementLine oWebiObjectWrapper.WrappedProperty(oProject,"Short Name",True), 1 oTable.IShowHideSectionsTable_AddContent oProject.GetProp("Current Project Phase","External") oTable.IShowHideSectionsTable_AddContent oProject.GetSelection("Select [Application] where [Project] = '"& strPro &"'").Count oTable.IShowHideSectionsTable_AddContent oProject.GetSelection("Select [Org-Unit] where [Project] = '"& strPro &"'").Count oTable.IShowHideSectionsTable_AddContent oProject.GetSelection("Select [Capability] where [Project] = '"& strPro &"'").Count oTable.IShowHideSectionsTable_AddContent oProject.GetSelection("Select [Standard] where [Project] = '"& strPro &"'").Count oTable.IShowHideSectionsTable_AddContent oProject.GetCollection("Risk").Count If ProCost <> "" and ProCost <> "N/A" then oTable.IShowHideSectionsTable_AddContent formatcurrency(ProCost) Else oTable.IShowHideSectionsTable_AddContent ProCost End If oTable.IShowHideSectionsTable_AddElementLine "Details", 2 strReq = "" strDep = "" strObj = "" strStd = "" strRisk = "" 'Details oTable.IShowHideSectionsTable_AddContent " " For Each oReq in oProject.GetSelection("Select [Application] where [Project] = '"& strPro &"'") strReq = strReq & vbCrlf & oWebiObjectWrapper.WrappedProperty(oReq,"Short Name",True) Next oTable.IShowHideSectionsTable_AddContent strReq For Each oDep in oProject.GetSelection("Select [Org-Unit] where [Project] = '"& strPro &"'") strDep = strDep & vbCrlf & oWebiObjectWrapper.WrappedProperty(oDep,"Short Name",True) Next oTable.IShowHideSectionsTable_AddContent strDep For Each oObj in oProject.GetSelection("Select [Capability] where [Project] = '"& strPro &"'") strObj = strObj & vbCrlf & oWebiObjectWrapper.WrappedProperty(oObj,"Short Name",True) Next oTable.IShowHideSectionsTable_AddContent strObj For Each oObj in oProject.GetSelection("Select [Standard] where [Project] = '"& strPro &"'") strStd = strStd & vbCrlf & oWebiObjectWrapper.WrappedProperty(oObj,"Short Name",True) Next oTable.IShowHideSectionsTable_AddContent strStd For Each oRisk in oProject.GetCollection("Risk") strRisk = strRisk & vbCrlf & oWebiObjectWrapper.WrappedProperty(oRisk,"Short Name",True) Next oTable.IShowHideSectionsTable_AddContent strRisk oTable.IShowHideSectionsTable_AddContent " " ' Sub Line For Each oSubPro in oProject.GetCollection("Project Step") oTable.IShowHideSectionsTable_AddElementLine oWebiObjectWrapper.WrappedProperty(oSubPro,"Short Name",True), 2 strSubPro = oSubPro.GetProp("Name") 'Numbers oTable.IShowHideSectionsTable_AddContent oSubPro.GetProp("Current Project Phase","External") oTable.IShowHideSectionsTable_AddContent oSubPro.GetSelection("Select [Application] where [Project] = '"& strSubPro &"'").Count oTable.IShowHideSectionsTable_AddContent oSubPro.GetSelection("Select [Org-Unit] where [Project] = '"& strSubPro &"'").Count oTable.IShowHideSectionsTable_AddContent oSubPro.GetSelection("Select [Capability] where [Project] = '"& strSubPro &"'").Count oTable.IShowHideSectionsTable_AddContent oSubPro.GetSelection("Select [Standard] where [Project] = '"& strSubPro &"'").Count oTable.IShowHideSectionsTable_AddContent oSubPro.GetCollection("Risk").Count If boolCost = 1 Then ProCost = oSubPro.GetProp("Estimated Cost") Else ProCost = "N/A" End If If ProCost <> "" and ProCost <> "N/A" then oTable.IShowHideSectionsTable_AddContent formatcurrency(ProCost) Else oTable.IShowHideSectionsTable_AddContent ProCost End If Next Next IReportGenerator_getAnalysisReport = oTable.IShowHideSectionsTable_getHTMLTable End Function