on 07-17-2013 10:28 AM
Hello,
using PD 16.1,
in a XEM i have the following structure of Extended Objects:
The following code is reading a part of this structur :
Dim m As ExtendedObject
Dim n As ExtendedComposition
Dim so As ExtendedSubObject
Dim prio
Dim col
Set col = InputModel.GetCollectionByStereotype("InformaticaMapping")
For Each m In col
If m.Code = "M_xyxyxyxyxyxxyxy_Nachladen" Then
Output ">" & m.Code
Dim ec As ExtendedCollection
Dim ecc 'As ExtendedCollection
For Each ec In m.ExtendedCollections
Output "ec-->" & ec.Name & " - " & ec.ClassName & " - no Stereotype"
For Each ecc In ec.Content
Output "ecc---->" & ecc.Name & " - " & ecc.ClassName & " - " & ecc.Stereotype
Dim eccec As ExtendedCollection
For Each eccec In ecc.ExtendedCollections
Output "eccec------>" & eccec.Name & " - " & eccec.ClassName & " - no stereotype"
Output "------>" & eccec.UOL
If ec.Name = "Source/Target2PDM" Then
Dim x
For Each x In eccec.Content
Output "--- ------>" & x
Output "--- ------>" & x.Code & " - " & x.Stereotype & " - " & x.GetExtendedAttribute("PDM Name")
If x.Stereotype = "PDM" Then
Dim y
y = getPDMbyName(x.Code)
If x = y Then Output "------- PDM object found !!! -----"
End If
Next x
End If
Next eccec
Next ecc
Next ec
End If
Next m
which creates the output:
? select_objects()
>M_xyxyxyxyxyxxyxy_Nachladen
ec-->SourceTarget - Extended Collection - no Stereotype
ecc---->target_0000_******************- Sourcetarget - Sourcetarget
eccec------>VerwendetesDocument - Extended Collection - no stereotype
------>ExtendedObjects::Sourcetarget XXXXXXXXXXXXXXXXXXXXXXXX::ExtendedCollections::Extended Collection XXXXXXXXXXXXXXXXX.VerwendetesDocument'
ec-->Source/Target2PDM - Extended Collection - no Stereotype
ecc---->Source/TargetPDM_1875 - Source/TargetPDM - Source/TargetPDM
eccec------>ModelName - Extended Collection - no stereotype
------>ExtendedObjects::Source/TargetPDM 'Source/TargetPDM_1875'::ExtendedCollections::Extended Collection 'Source/TargetPDM_1875.ModelName'
--- ------>PDM XYXXYXYXYXXYXXYXX--- ------>xyxyxyxyxyxyxyxyxyxyxyxyxxy - PDM - DM_ODP_TBDI0259KONTRAHT_COUNTER_PARTY
------- PDM object found !!! -----
eccec------>SourceTarget - Extended Collection - no stereotype
------>ExtendedObjects::Source/TargetPDM 'Source/TargetPDM_1875'::ExtendedCollections::Extended Collection 'Source/TargetPDM_1875.SourceTarget'
--- ------>Sourcetarget xyxyxyxyxyxyxyxyxyxyxyxyxy--- ------>lookup_0000_************** - Sourcetarget -
So far so good, but: every thing is working fine because i created all my objects using the PD forms:
but now i need to create the objects via VBS automaticly.
I figured out as the point to insert the subobjects into the content object of ec-->Source/Target2PDM - Extended Collection
For Each ec In m.ExtendedCollections
If ec.Name = "Source/Target2PDM" Then
Dim ecc
For Each mst In MSTL
Set ecc = ec.Content.CreateNew(PdCommon.cls_ExtendedCollection)
but when i try i always get the following error:
all ways trying to use createobject and then adding the object also failed
Any suggestions???
Thanks in advance
DJ
I found the solution for this:
here is just the inner code, when some people want i will do later a blog about it with a usecase and some detailed information:
Dim x As ExtendedObject
Dim newObjcol As ObjectBag
Set newObjcol = InputModel.GetCollectionByStereotype("Source/TargetPDM")
Set x = newObjcol.CreateNew(PdCommon.cls_ExtendedObject)
x.Name = "STP_" & UCase(PDMName) & "_" & UCase(mst)
x.Code = "STP_" & UCase(PDMName) & "_" & UCase(mst)
ec.Content.Add x
Dim ecc1, ecc2 As ObjectBag
Set ecc1 = x.GetCollectionByName(ec.Content.Source & ".ModelName")
Set ecc2 = x.GetCollectionByName(ec.Content.Source & ".SourceTarget")
ecc1.Add getPDMbyName(PDMName)
ecc2.Add getSTbyName(mst)
cheers
deejay
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
88 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.