Book a Demo

Author Topic: Bookmarks for Elements in Custom Script Templates  (Read 4930 times)

Jonathan Lubach

  • EA User
  • **
  • Posts: 40
  • Karma: +0/-0
    • View Profile
Bookmarks for Elements in Custom Script Templates
« on: November 03, 2015, 09:17:00 pm »
Hi together,

is there a way to create bookmarks for elements printed with the script template fragment similar to the solution usable in SQL template fragments?

See help for EA 12.1:
Quote
You can also make your column entries into hyperlinks to the element entries in the generated document. The column header field (in the template text itself, in the 'Custom' panel) must contain the suffix '- Hyperlink'; for example:

     Elements-Hyperlink      (Elements.Hyperlink is also valid for non-Jet repositories)

The column entries, or values, must have the format:

     {guid}LABEL

In this format, {guid} is the GUID of the element to link to and LABEL is the hyperlink text (such as the element name), either manually inserted or returned from another command. For example:

     {123-456-7890}Class2

In the generated report this displays as Class2, which links to the description of Class2 in the document.

Taken from
http://www.sparxsystems.com/enterprise_architect_user_guide/12.1/report_generation/custom_sql_fragments.html

Thanks!

Jonathan
Enterprise Architect Corporate Edition v12.1
Windows 7 64bit

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Bookmarks for Elements in Custom Script Templa
« Reply #1 on: November 03, 2015, 09:38:18 pm »
You need to set t_object.tagged to 1. (Reminds me to update the section of my Inside book.)

q.

Jonathan Lubach

  • EA User
  • **
  • Posts: 40
  • Karma: +0/-0
    • View Profile
Re: Bookmarks for Elements in Custom Script Templa
« Reply #2 on: November 04, 2015, 12:27:56 am »
Quote
You need to set t_object.tagged to 1. (Reminds me to update the section of my Inside book.)

q.

Thanks for that qwerty. For creating hyperlinks I just realised, that the construct for SQL also works in script template fragments (XML tag e.g. "Name-Hyperlink" and custom field "Name.Hyperlink" with value "{GUID}Name")

I try to realize a reference directory for a document. All references are available as "Artifact"-Elements. The script in the template fragment collects all hyperlinks in any package or element note and prints the found artifact-elements to the return string (-> result: a list of elements). The entries of this list shall be the jump targets of the hyperlinks throughout the document.

If printing Elements with normal document templates within the Content range "Element", the bookmarks will automatically be generated and the jump targets for the hyperlink are valid.

Now I need a construct for a script template fragment to realise hyperlink jump targets to elements gathered by the script in the template fragment.

I tried
Code: [Select]
var xmlName = xmlDOM.createElement( "Name" );
xmlName.text = oArtifact.Name;
xmlName.setAttribute("tagged", "1");
xmlRow.appendChild(xmlName);

or adding the EABOOKMARK element (see http://www.sparxsystems.com/enterprise_architect_user_guide/12.1/report_generation/custom_query_fragments.html)
Code: [Select]
var xmlName = xmlDOM.createElement( "EABOOKMARK" );
xmlRow.appendChild(xmlName);

but all these solutions don't work  :(

Thanks!

Jonathan
Enterprise Architect Corporate Edition v12.1
Windows 7 64bit