Prev | Next |
How to Define a Template Selector Fragment
A Template Selector is a Template Fragment that calls other Template Fragments depending on what type of element is being reported. The Template Fragments being called can be system Fragments or existing user-defined Fragments, as listed in the Resources window.
Access
Use one of the methods outlined here to display the 'Custom Query' page of the 'Document Options' dialog.
Ribbon |
Publish > Tools > Document Templates : <select a fragment template> : (Document Options icon) > Custom Query |
Keyboard Shortcuts |
> Templates | Fragments | Double-click on <Fragment name>, then (Document Options icon) > Custom Query |
Set Up the Template Selector
Option |
Action |
See also |
---|---|---|
Template Selector |
Click on this radio button to define the template selection commands. |
|
data field |
On separate lines, type each element type and the name of the Template Fragment to use for that element type, in the format: ElementType:<stereotype>:Fragment Name For example (elements not extended by a stereotype): Action::Behavioral ActionPin::Simple Behavioral CollaborationUse::Structural and (element extended by a stereotype): Class:table:Database Table To identify the fragment to use if elements are reported that have not been specifically identified, type: default::Fragment Name Also see the Notes section in this topic. |
Element Class Resources |
OK |
Click on this button to save the changes you have made and close the 'Document Options' dialog. |
Notes
Further advice on providing a value for the data field:
To a certain extent you can adapt the 'extended by stereotype' line according to what alternative modeling language you are using, what you specifically want to extract in the report, and what elements exist under the Package or element you execute the report on. For example:
- Extract Archimate Business Actor elements
- From a structure containing UML and Archimate elements - Class: Archimate_Business Actor:BusActFrag
- From a structure containing only Archimate elements - Class:BusinessActor:BusActFrag
- From a structure containing only Archimate Business Actor elements - Class::BusActFrag - Extract Business Actor elements
- From a structure containing UML and Archimate elements - Class:Business Actor:BusActFrag
- From a structure containing only Archimate elements - Class:BusinessActor:BusActFrag
- From a structure containing only Business Actor elements - Class::BusActFrag
To establish the type and Sterotype details of a representative element selected in the Project Browser, run this query in the SQL scratch pad (use the ribbon option 'Start > Explore > Search > Model : > SQL Scratch Pad'):
- Select t_object.name, t_object.Object_Type, t_object.Stereotype from t_object where t_object.Object_ID=#CurrentElementID#
For example, selecting a BPMN DataObject in the Project Browser and running this SQL gives:
Name - Issue List[Initial]
Object_Type - Artifact
Stereotype - DataObject
So you would use the combination Artifact:DataObject:<fragment name> in the data field
Alternatively, do not use a Template Selector fragment and create a simple template to operate on the Element section of the report, to extract elements of Type - Class and Stereotype - Business Actor. Run this on the specific element(s).
For a complete example, open the system-supplied Template Selector in the 'Document Generation | System Templates | Fragments' folder of the Resources window and review the 'Custom Query' tab of the 'Document Options' dialog.
Learn more