Accessing Packages without changing Scope

Starting point for “ask and learn more about MagicDraw”

Moderator: Moderators

Accessing Packages without changing Scope

Postby lamarts@san.rr.com » Thu Jun 04, 2020 6:30 pm

I have a list of packages each containing a table to be part of a report template.

I have scripts for each table and they work when I set the scope to the specific "table package" when generating the report.
See attachment

When I generate the report, I want the parent package as the scope and to access to the specific "table package" in my script.

I tried:
#foreach($p in $Package)
#if($p.name == "Table 1")
#foreach($c in $Class)
$c.name
#end
#end
#end

I get all of the class elements in all of the Tables. I only want to work on a specific package. any ideas?
Thanks
You do not have the required permissions to view the files attached to this post.
lamarts@san.rr.com
Forum Newbie
Forum Newbie
 
Posts: 2
Posts Rating:0
Joined: Mon May 25, 2020 7:58 am

Re: Accessing Packages without changing Scope

Postby lamarts@san.rr.com » Fri Jun 05, 2020 8:49 am

ok...got some help...
#foreach($c in $Class) will return everything in the scope package in lieu of the specific package.

back to the drawing board. :(
lamarts@san.rr.com
Forum Newbie
Forum Newbie
 
Posts: 2
Posts Rating:0
Joined: Mon May 25, 2020 7:58 am

Re: Accessing Packages without changing Scope

Postby beckieholzer@gmail.com » Fri Feb 26, 2021 9:35 am

Late reply but in case anyone else comes across this and needs the code:

#set($ApplicableDocumentsTableName = “TBX Log”)
#foreach($diagram in $sorter.humanSort($Diagram))
#if($diagram.diagramType == “Generic Table”)
#set($ApplicableDocumentsTableName = $diagram.name)
#if($ApplicableDocumentsTableName.contains("TBX Log"))
#createTable($diagram)
#end#end#end

will return an instance of a table named TBX Log (of type Generic Table).
beckieholzer@gmail.com
Forum Newbie
Forum Newbie
 
Posts: 1
Posts Rating:0
Joined: Tue Feb 23, 2021 6:52 pm


Return to New to MagicDraw

Who is online

Users browsing this forum: No registered users and 1 guest