‎09-08-2012 03:42 AM - edited ‎09-08-2012 03:42 AM
I have a Particiant with Business Function assigned to it. However, the following script fails to find it. Any suggestions as to how to access the ClassID of a concrete class within an Abstract class Collection?
Sub CmdInvoke(mgobjSource as MegaObject, intCmdNumber as Integer)
Dim col_Elements As MegaCollection
Dim col_Functions As MegaCollection
Dim obj_Element As MegaObject
Dim obj_Object As MegaObject
Dim obj_MegaRoot As MegaRoot
Dim int_Count As Integer
obj_MegaRoot = mgobjSource.GetRoot
col_Elements = mgobjSource.GetCollection("Assignment")
For Each obj_Element In col_Elements
If obj_MegaRoot.GetCollection("MetaClass").Item("Business Function").GetId = obj_Element.GetClassId Then
MsgBox "Object is a Business Function"
End If
Next
End Sub
Solved! Go to Solution.
‎09-08-2012 03:13 PM
Hello,
I Think you will have better answer in the technical part of the Community but try this
Option Explicit ' ------------------------------------------------------------------ ' returns true if the MEGA object is of the given type. Function isTypeOf (omoObject, sTypeIdentifier) Dim oRoot set oRoot = omoObject.getRoot isTypeOf = false if oRoot.CurrentEnvironment.Toolkit.SameID(omoObject.GetType.GetClassObject.rpid, sTypeIdentifier) then isTypeOf = True elseif omoObject.GetType.GetClassObject.UpperClasses.Item(sTypeIdentifier).GetId <> 0 then isTypeOf = True end if end function '--------------------------- ' Your Code Sub CmdInvoke(mgobjSource as MegaObject, intCmdNumber as Integer) Dim col_Elements As MegaCollection Dim col_Functions As MegaCollection Dim obj_Element As MegaObject Dim obj_Object As MegaObject Dim obj_MegaRoot As MegaRoot Dim int_Count As Integer obj_MegaRoot = mgobjSource.GetRoot col_Elements = mgobjSource.GetCollection("Assignment") For Each obj_Element In col_Elements If isTypeOf (obj_Element, "~irUiO9B5iCO0[Business Function]") Then MsgBox "Object is a Business Function" End If Next End Sub
It could solve your problem
JF