Check if element is in package

Uploaded report templates and discussions about reports.

Moderators: sarawut_w, Moderators

Check if element is in package

Postby jnicholas330 » Mon Jul 23, 2018 11:29 am

Hello,

I have a report that uses VTL to generate Word documents. The report iterates over a class model, and hyperlinks attributes' types to their associated documentation. This is done with the bookmark capability

Code: Select all
$bookmark.open($attr.type.ID, $attr.type.name)


The problem is that some types are not included in the package that I've included in the element scope. The bookmark code still creates a hyperlink, but the link goes nowhere. What I'd like to do is add a conditional that checks if the ID is in the current package (and any subpackages that it contains) being iterated over, and only then emit then hyperlink.

How can this be done?
jnicholas330
Forum Newbie
Forum Newbie
 
Posts: 18
Posts Rating:4
Joined: Tue Jun 20, 2017 10:26 am

Re: Check if element is in package

Postby sarawut_w » Mon Jul 23, 2018 9:17 pm

Hello,

The "$elements" is a default variable which is used for containing all elements in the selected scope.
You could check whether the "$attr.type" is in the selected scope or not, by this sample code:
Code: Select all
$elements.contains($attr.type)


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


Return to Report Engine

Who is online

Users browsing this forum: No registered users and 1 guest

cron