PDA

View Full Version : igrafx EnterpriseXML fields for RACI



trishc
07-19-2016, 11:44 AM
I am using VBA to extract information from igrafx flowcharter (Business Process Management Software). I have it all working, despite a few quirks I can't figure out. I didn't write the original code, I just modified it for my purposes.

I need to know if anyone is familiar with igrafx and their specific reference library. I need to have the RACI (Responsible, Accountable, Consulted, and Informed) information for each diagram object within the active diagram. The support from igrafx said this, but didn't offer any examples, and I can seem to find one, so I am stuck:

"You can get a fields text from theDiagramObject (the parent of the shape) under Fields. Once you've located the appropriate field,you can use FieldText to get the value."

Basically, the diagram object has depts., and I need to see which depts. are associated to which RACI attribute for each diagram.

Here is my code. Keep in mind, I am outputting to the screen, as well as writing to a file. Both work fine. I just need that little bit more info and I am done.

I also have a minor issue that is bugging me. Initially, I was writing/displaying activates that had only attached inputs and outputs. But I do want to see all activities, but the way this is setup, I am forced to display/write an extra line for the ones that have inputs/outputs, so I can at least see the ones with inputs/outputs. It's not a big deal. The RACI stuff is more important.


Sub ReportOnAttached()
'We need a diagram
If ActiveDiagram Is Nothing Then Return
'Check to make sure it's a BPMN diagram
If ActiveDiagram.DiagramType.ClassID <> "{C3447FD6-3C60-4426-BC4D-D91789BCECF5}" Then Return

Dim output As OutputPane
Set output = Application.OutputWindow.OutputPanes.Add("BPMN Activity Report")
output.Clear
Application.OutputWindow.Visible = True

Dim dname As String
dname = ActiveDiagram.Name
Dim MyFile As String
'MyFile = "C:\Users\collinsp\Documents\SSC\NEUB\Process\Reports\EBIDM Process Report -- " & dname & " -- " & Format(Now, "mmm dd, yyyy hh-mm")
MyFile = "C:\Users\collinsp\Documents\SSC\NEUB\Process\Reports\EBIDM Process Report"

Open MyFile For Output As #2

output.AddString "Process: " + dname
'For each diagram object
Dim dobj As DiagramObject
For Each dobj In ActiveDiagram.DiagramObjects

Dim shp As shape
Set shp = Nothing

'Only Shapes can be Activities, which in turn can be BPMN Activities
If dobj.Type = ixObjectShape Then Set shp = dobj.shape

If Not shp Is Nothing Then

Dim ac As Activity

'Get the Activity
Set ac = dobj.AsType("iGrafx.Activity")

'Check if the activity is a BPMN activity
If Not ac Is Nothing And ac.BPMNType = ixBPMNActivity Then

Dim attachedObjs As ObjectRange
Set attachedObjs = dobj.AttachedObjects
'Output the shape text, and type name
output.AddString shp.ShapeClass.Name + ": " + shp.ShapeNumber.FormattedValue + " " + shp.Text
Write #2, dname + "!" + shp.ShapeClass.Name + "!" + shp.ShapeNumber.FormattedValue + "!" + shp.Text + "!" + " " + "!" + " " + "!" + shp.Note.Text
'If we have attached objects
If Not attachedObjs Is Nothing And attachedObjs.Count > 0 Then
'Output RACI -- NEED THE VARIABLES
'output.AddString "Accountable: "
'output.AddString "Responsible: "
'output.AddString "Consulted: "
'output.AddString "Informed: "
Dim attachedObj As DiagramObject
For Each attachedObj In attachedObjs

Dim attachedShp As shape

If attachedObj.Type = ixObjectShape Then Set attachedShp = attachedObj.shape
If attachedObj.Type = ixObjectTextGraphic Then Set attachedShp = attachedObj.TextGraphicObject.shape

'and then output the attached shapes text and type name
If Not attachedShp Is Nothing Then
output.AddString attachedShp.ShapeClass.Name + ": " + attachedShp.Text
Write #2, dname + "!" + shp.ShapeClass.Name + "!" + shp.ShapeNumber.FormattedValue + "!" + shp.Text + "!" + attachedShp.ShapeClass.Name + "!" + attachedShp.Text + "!" + " "
End If

Next
'output Notes
On Error Resume Next
output.AddString "Notes: " + shp.Note.TextLF

End If

End If

End If
Next
Close #2
End Sub