Sparx Systems Forum

Enterprise Architect => General Board => Topic started by: MRrobot on October 17, 2018, 11:49:42 pm

Title: Shape Script: print TaggedValue as decoration
Post by: MRrobot on October 17, 2018, 11:49:42 pm
Hi There, I got a Stereotype with 4 status attributes, they're all using one enumeration of status texts to fill the values for following attribute-names:
My problem is that I want to print all four attribute values inside the Element Shape. I thought about a decoration, and the user guide  https://sparxsystems.com/enterprise_architect_user_guide/10/extending_uml_models/displaying_element_properties.html  (https://sparxsystems.com/enterprise_architect_user_guide/10/extending_uml_models/displaying_element_properties.html) says:
print("#TAG:condition#");
But how is this used? TAG is the TaggedValue name - allright. In my case there is no condition, I just want to list the values of all attributes:

decoration deco {
printLn("#Status_2015:#");
printLn("#Status_2016:#");
printLn("#Status_2017:#");
printLn("#Status_2018:#");
}

This decoration just prints the text with four lines of attribute names - no values :((

How to use "print("#TAG:condition#");" - when there is no condition?
How is :condition# used?
How can TaggedValue-vaules be printed?
Title: Re: Shape Script: print TaggedValue as decoration
Post by: Geert Bellekens on October 17, 2018, 11:57:35 pm
Here's an example of one of my shapescript:
The "TAG" part is part of the syntax. The "condition" part should be replaced by the name.

Code: [Select]
shape expression
{
if (hastag("compositionExpression"))
{
print("#TAG:compositionExpression#");
}
else
{
PrintWrapped("Expression missing!");
}
}

For more example shapescripts see: https://github.com/GeertBellekens/Enterprise-Architect-Shapescript-Library (https://github.com/GeertBellekens/Enterprise-Architect-Shapescript-Library)

Geert
Title: Re: Shape Script: print TaggedValue as decoration
Post by: MRrobot on October 18, 2018, 01:21:14 am
Thank you Geert, works perfect!

Regards MRrobo