You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Current »

You can directly get the property value of the element by calling property name:

$element.propertyName

 

propertyName should be typed in camel case style. The name and returned type of property can be found in MagicDraw UMLMetaModel UserGuide. It lists all the properties which can be called through each element type.

Please be aware of the type of the returned value, as some properties may return an array. You can get each value by using a #foreach directive or by specifying array index number. For example:

#foreach($c in $class.classifier)
$c.name
#end
#set($classifier = $class.classifier)
$classifier.get(0)
$classifier.get(1)

Moreover, the customized elements are able to get their property value immediately by calling property name:

$RepresentationText.propertyName

You can see the representation text of the element by opening the Specification dialog.

The dialog name pattern is 

Specification of <RepresentationText> <ElementName>

While the property name is shown in the same dialog.

If the property value is not printed out to your report, you can assume the property that you call is not the property of the customized element. It may be the property of the applied stereotype. You would rather check the stereotype owner of that property by going to the Applied Stereotype property of the element, then right click on the right column, and select the stereotype in the containment tree.

If you navigate to the stereotype element on the containment tree, then you can expand it to see its owned properties. If you can see your desired property in the stereotype, you can get its value by:

$report.getStereotypePropertyString($element, "stereotypeName", "propertyName")


We also provide helper module in section Helper tools. These modules are utility modules for getting property values. More details about openAPI of each element can be found at:

{md_install}\plugins\com.nomagic.magicdraw.reportwizard\api\javadoc.zip