cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Concrete class ID from an Abstract Class Collection

Solved
New Contributor

Concrete class ID from an Abstract Class Collection

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

1 Reply

Re: Concrete class ID from an Abstract Class Collection

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

Tags (1)