14-08-2012 04:04 AM - edited 14-08-2012 04:05 AM
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.
'MegaContext(Fields,Types) 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 Next End Sub
Solved! Go to Solution.
15-08-2012 10:58 AM
Merci Jerome.
Thorough and specific as usual.
Cheers,
francois
14-08-2012 10:20 AM - edited 14-08-2012 11:06 AM
Hello François
As a general manner, use the ID of the metamodel element and not the name of the metamodel element/
Recommended
Set col_BPMN_Elements = GetCollection("~JW7j6VRt9H40[BPMN Element]")
or
Set col_BPMN_Elements = GetCollection("~JW7j6VRt9H40")
Not recommended
Set col_BPMN_Elements = GetCollection("BPMN Element")
See also http://community.mega.com/t5/custom/page/page-id/mega-kb-solution?sid=50120000000mqR5AAI
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()