Extracting Smart Package Elements

Uploaded report templates and discussions about reports.

Moderators: sarawut_w, Moderators

Extracting Smart Package Elements

Postby felipe.arredondo@navy.mil » Tue May 26, 2020 12:35 pm

TW Baseline2.mdzip
I want to extract the names of the smart package elements with the velocity script below. However I cannot seem to get the element type (Class with stereotype Baseline_2 & Requirement) in my code correct. Hence any help would be greatly appreciated.



#set($test = $report.findElementInCollection($SmartPackage, “pspec”))
#set($filterReq = $report.filterElement($test.ownedElement,[ “Baseline_2”]))
#foreach($req in $sorter.humanSort($filterReq, “name”))
$req.name
#end
You do not have the required permissions to view the files attached to this post.
felipe.arredondo@navy.mil
Forum Newbie
Forum Newbie
 
Posts: 11
Posts Rating:0
Joined: Tue May 10, 2016 10:56 am

Re: Extracting Smart Package Elements

Postby sarawut_w » Tue May 26, 2020 8:42 pm

Hello,

Thank you for your project.
You could not get the referenced elements of Smart Package by $test.ownedElement property, you would rather get them through $test.addtionalElements property instead.

Best regards,
Sarawut W.
Support Engineer
sarawut_w
No Magic
No Magic
 
Posts: 428
Posts Rating:37
Joined: Thu Jun 23, 2011 12:47 am

Re: Extracting Smart Package Elements

Postby Chris.Korzeniowski » Thu Jul 30, 2020 12:43 pm

sarawut_w wrote:Hello,

Thank you for your project.
You could not get the referenced elements of Smart Package by $test.ownedElement property, you would rather get them through $test.addtionalElements property instead.

Best regards,
Sarawut W.
Support Engineer

What about using $test.additionalContentCalc? $test.additionalElements appears to only give the items specifically added, without the results of the query. additionalContentCalc seems to have the query results.
Chris.Korzeniowski
Forum Newbie
Forum Newbie
 
Posts: 4
Posts Rating:0
Joined: Fri Jul 17, 2020 11:55 am
Full name: Christopher Korzeniowski

Re: Extracting Smart Package Elements

Postby sarawut_w » Thu Jul 30, 2020 9:03 pm

If you add elements through query, the calculated elements would be listed in $smartpackage.additionalContentCalc, the additionalElements property would be empty, it is for manually adding elements.
sarawut_w
No Magic
No Magic
 
Posts: 428
Posts Rating:37
Joined: Thu Jun 23, 2011 12:47 am

Re: Extracting Smart Package Elements

Postby GLHF » Wed Aug 05, 2020 6:37 am

Code: Select all
$report.getOwnedElementsIncludingAdditional(element, includePureOwned) : List<Element>


returns owned elements of a given element including additional owned elements. This should work fine.
GLHF
Forum Newbie
Forum Newbie
 
Posts: 15
Posts Rating:0
Joined: Wed Aug 05, 2020 6:17 am


Return to Report Engine

Who is online

Users browsing this forum: No registered users and 7 guests