Using basic capabilities > Overview of using basic capabilities > Analytics > Analytic examples in System Architect > Application portfolio management
  
Application portfolio management
This analytic reads the cost of the process set in the Portfolio chapter of an application definition. It also examines the service duration of the application. It then compares this to the amount of budget available in the cost center which is related to the application. If an application is over budget, a gauge with its pointer set to the red region is displayed next to its symbol on the diagram. If under budget the pointer on the gauge points to green. If 10% either side, the pointer on the gauge points to amber.
To run this analytic
1 Specify the cost of a process set in the Portfolio chapter of each application definition, and specify the amount of budget available in the cost center related to each application.
2 Open a diagram that models the applications for which you have specified cost.
3 Right-click the diagram workspace, and then click Show Analytic Depictions.
4 From the Explorer, in the Definitions group on the All Methods tab, find the Analytic definition type, and then drag the Application Portfolio analytic onto the diagram workspace.
This graphic is described in the surrounding text.
Example source for analytic macro
Sub PortfolioMgt()
' This analytic macro takes the cost of the process set in the Portfolio Mgmt chapter
' and also examines the service duration of the application. It then compares this to
' the amount of budget available in the cost center.
' Only for current diagram

Dim sa As Application
Dim oCurrentDgm As Diagram
Dim colApps As SAObjects
Dim oAppSym As symbol
Dim oAppDef As Definition
Dim colCostCenters As OfCollection
Dim oCostCenterDef As Definition
Dim dtFrom As Date, strFromDate As String
Dim dtTo As Date, strToDate As String
Dim lngDateDiff As Long ' holds difference between in service date and effective date for application
Dim strPerpCost As String
Dim strMaintCost As String
Dim strRentalCost As String
Dim strBuildCost As String
Dim strBudget As String
Dim lngTotalCost As Long
On Error Resume Next
Set sa = New Application
Set oCurrentDgm = sa.Encyclopedia.GetCurrentDiagram

If oCurrentDgm Is Nothing Then
MsgBox SAXRes.GetLocalString(IDS_SAAutoAnalytics____adiagrammustbeopentorunthisanalytic), vbExclamation
Else
Set colApps = oCurrentDgm.GetFilteredSymbols(vbNullString, ETCAAPROCESS)
colApps.ReadAll

For Each oAppSym In colApps
Set oAppDef = oAppSym.Definition

' get length of service for application
strFromDate = oAppDef.GetProperty("In Service Date") 'DEV_STRING
strToDate = oAppDef.GetProperty("Effective Date") 'DEV_STRING
dtFrom = DateSerial(Mid(strFromDate, 1, 4), Mid(strFromDate, 5, 2), Mid(strFromDate, 7))
dtTo = DateSerial(Mid(strToDate, 1, 4), Mid(strToDate, 5, 2), Mid(strToDate, 7))
lngDateDiff = DateDiff("yyyy", dtFrom, dtTo) 'DEV_STRING

' get costs for application
strPerpCost = oAppDef.GetProperty("Perpetual License Cost") 'DEV_STRING
strMaintCost = oAppDef.GetProperty("Yearly Maintenance Cost") 'DEV_STRING
strRentalCost = oAppDef.GetProperty("Yearly Rental Cost") 'DEV_STRING
strBuildCost = oAppDef.GetProperty("Build Cost") 'DEV_STRING

' get cost center and budget
Set colCostCenters = oAppDef.GetPropertyAsCollection("Cost Center") 'DEV_STRING
For Each oCostCenterDef In colCostCenters
strBudget = oCostCenterDef.GetProperty("Total Center Cost") 'DEV_STRING
Next oCostCenterDef

' calculate costs and compare to budget
If strPerpCost <> vbNullString Then
lngTotalCost = (lngDateDiff * Val(strMaintCost)) + strPerpCost
ElseIf strRentalCost <> vbNullString Then
lngTotalCost = lngDateDiff * Val(strRentalCost)
ElseIf strBuildCost <> vbNullString Then
lngTotalCost = Val(strBuildCost)
Else
lngTotalCost = 0
End If

' set gauge depending on values of totalcost vs budget
If lngTotalCost / Val(strBudget) >= 0.9 And lngTotalCost / Val(strBudget) <= 1.1 Then
' is 10% in either direction so set to amber
oAppSym.SetProperty "Analytic Gauge", "Amber" 'DEV_STRING
ElseIf lngTotalCost / Val(strBudget) < 0.9 Then
' under budget set to green
oAppSym.SetProperty "Analytic Gauge", "Green" 'DEV_STRING
ElseIf lngTotalCost / Val(strBudget) > 1.1 Then
' over budget set to red
oAppSym.SetProperty "Analytic Gauge", "Red" 'DEV_STRING
Else
'dont set
oAppSym.SetProperty "Analytic Gauge", "None" 'DEV_STRING
End If
oAppSym.Save
Next oAppSym
End If
RefreshDiagram
Set sa = Nothing
End Sub

Private Sub RefreshDiagram()
Dim ISA As ISAImf
On Error Resume Next
Set ISA = Application.Interface("ISAImf") 'DEV_STRING
ISA.SAExecuteMenuCommand 310
End Sub
See also
Analytic examples in System Architect