Using basic capabilities > Overview of using basic capabilities > Analytics > Analytic examples in System Architect > Organization unit roles
  
Organization unit roles
This analytic graphically shows an icon for org units with or without roles assigned to them.
To run this analytic
1 Assign roles to organizational units.
2 Open an Organization Chart, right‑click the diagram workspace, and select Show Analytic Depictions from the popup dialog.
3 From the Explorer, in the Definitions group on the All Methods tab, find the Analytic definition type, and select the Organizational Units without Roles analytic definition.
4 Drag and drop the Organizational Units without Roles analytic onto the diagram workspace of the open Organization Chart diagram.
This graphic is described in the surrounding text.
Example source for analytic macro
Sub LocateRoles()
' This analytic macro determines whether a org unit definition has roles assigned to it
' Only for current diagram
Dim blnHasRoles As Boolean ' flag to determine whether roles are present
Dim oCurrentDgm As Diagram
Dim oOrgUnitSym As symbol
Dim colOrgUnits As SAObjects
Dim colRoles As OfCollection
Dim sa As Application
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 colOrgUnits = oCurrentDgm.GetFilteredSymbols(vbNullString, ETCATORGUNIT)
colOrgUnits.ReadAll

For Each oOrgUnitSym In colOrgUnits
blnHasRoles = False
If oOrgUnitSym.Definition.GetProperty("Roles within Unit") <> vbNullString Then 'DEV_STRING
Set colRoles = oOrgUnitSym.Definition.GetPropertyAsCollection("Roles within Unit") 'DEV_STRING
If colRoles.Count = 0 Then
blnHasRoles = False
Else
blnHasRoles = True
End If
End If
If blnHasRoles = True Then
oOrgUnitSym.SetProperty, "None" 'DEV_STRING
Else
oOrgUnitSym.SetProperty "Analytic Role", "Not Present" 'DEV_STRING
End If
oOrgUnitSym.Save
Next oOrgUnitSym

RefreshDiagram
Set colRoles = Nothing
Set colOrgUnits = Nothing
Set sa = Nothing
End If
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 collection definition
Analytic definition
Analytic examples in System Architect
Building analytics
Heat Map Manager
Analytic examples in System Architect