MagicDraw 18.5 Documentation

Skip to end of metadata
Go to start of metadata

Getting element values to a template

 

You can access the value of an element, and include it in a report in Report Wizard.

How to get a value from a modeling tool element to a template

  1. First you need to know the element type and attributes. Open the Specification dialog to see the type and attributes (Figure 1).


    The Specification dialog showing the element type on the title bar and the attributes in the properties specification table

  2. Open Microsoft Word and type, for example:

 

#foreach ($class in $Class)
 Name: $class.name
 Owner: $class.owner.name
 Visibility: $class.visibility
 Is Abstract: $class.isAbstract
#end

 

The example above shows that $Class is an array that contains all the Class elements in a Selected Element Scope (see Report Wizard user guide for more information). $class is the individual Class element inside the array. To access the value of a property in $class, type: $class followed by "." and the attribute's name (".name", ".visibility", and ".isAbstract" are the names of the $class attribute). The syntax for accessing the attribute value can be represented by: $[Referenced object].[Attribute's name]

When you generate the output of the template for a project with a single Class element, the result will be shown as follows:

 

Name: Customer
 Owner: com
 Visibility: public
 Is Abstract: false
On this page

Glossary

 

 Array

An array is a container object that holds a fixed number of values of a single type. The length of an array is established when the array is created. After it is created, its length is fixed.

 Attribute

Attribute defines values that can be attached to instances of the class or interface. For example, an attribute of a class represents the characteristics of the class.

 Class

Class is the concrete realization of EncapsulatedClassifier and BehavioredClassifier. The purpose of a class is to specify a classification of objects, and to specify the Features that characterize the structure and behavior of those objects.

 Element

Element is a constituent of a model. Every element has the inherent capability of owning other elements. When an element is removed from a model, all its ownedElements are also removed from the model. The abstract syntax for each kind of element specifies what other kind of elements it may own. Every element in a model must be owned by exactly one other element of that model, with the exception of the top-level Packages of the model.

 

More information about working with values in Report Wizard

To learn more about working with values in Report Wizard, visit the following pages:

Retrieving slot value

Getting property value

 

  • No labels