Page 1 of 1

Accessing Inner Elements in VTL

PostPosted: Mon May 24, 2021 3:42 pm
by ghillaero
I want to loop through the elements in a package in the same order as they appear in the containment tree. Currently I use a foreach loop over the package's owned elements:

#foreach($e in $thePackage.ownedElement)
... do stuff
#end

However, the elements in the ownedElement attribute of the package may not be in the same order as they appear in the containment tree. The latter is defined by the inner elements property but I can't figure out how to access it with VTL code. Any suggestions?

Thanks,
Geoff

Re: Accessing Inner Elements in VTL

PostPosted: Tue May 25, 2021 1:27 am
by sarawut_w
Hello Geoff,

What is your MagicDraw version?
Since 19.0SP4, MagicDraw provides $sorter.containmentTreeSort($alist) for sorting elements in the same order on containment tree.

Best regards,
Sarawut W.
Support Engineer

Re: Accessing Inner Elements in VTL

PostPosted: Tue May 25, 2021 10:48 am
by geoffrey.a.hill@boeing.com
Thanks Sarawut,

Unfortunately it looks like I have SP3. I tried containmentTreeSort but it did not work.

Any solutions for SP3?

Geoff

Re: Accessing Inner Elements in VTL

PostPosted: Wed May 26, 2021 8:36 pm
by sarawut_w
Hello,

We do not provide this function in 19.0SP3.
We have the patch file only in 19.0SP2.

Best regards,
Sarawut