Showing results for 
Search instead for 
Did you mean: 

API: GetType in VB


API: GetType in VB

Hi there,


Mega 2009 SP5 CP6 and CP7.


Using the Abstract metamodel, I need to export the BPMN Element collection and get the Sub-MetaClass (eg. Organizational Process) for each item in this collection.


The GetType method should do the trick, as explains on p53 of the MetaStudio doc.  For some reasons, I get this error:

“Variable uses an Automation type not supported in VBScript:” 


Here's the code I'm using. Thanks for your help.


Option Explicit

Sub CmdInvoke(mgobjSource as MegaObject, intCmdNumber as Integer)
Dim col_Participant_Elements As MegaCollection
Dim col_BPMN_Elements As MegaCollection
Dim col_OrgProcs as MegaCollection
Dim obj_Element As MegaObject
Dim obj_BPMN_Element as MegaObject
Dim obj_Object As MegaObject

col_BPMN_Elements = mgobjSource.GetCollection("BPMN Element")
col_OrgProcs = col_BPMN_Elements.GetType("Organizational Process")

For Each obj_Object In col_OrgProcs
  Msgbox obj_Object.shortName

End Sub 
Tags (2)
2 Replies

Re: API: GetType in VB

Hello François


As a general manner, use the ID of the metamodel element and not the name of the metamodel element/



   Set col_BPMN_Elements = GetCollection("~JW7j6VRt9H40[BPMN Element]")


  Set col_BPMN_Elements = GetCollection("~JW7j6VRt9H40")


Not recommended

  Set col_BPMN_Elements = GetCollection("BPMN Element")


See also


When using GetType for a collection, you need to quote the MetaClass ID and not the MetaClass Name

Example (VB script):


Set cBE = GetCollection("~JW7j6VRt9H40[BPMN Element]")
Print "Number of BPMN Element objects: " & cBE.count()
Set cOP = cBE.GetType("~gsUiU9B5iiR0[Organizational Process]")
Print "Number of Organizational Process objects: " & cOP.count()




Re: API: GetType in VB

Merci Jerome.


Thorough and specific as usual.