Book a Demo

Author Topic: Shape Script: print TaggedValue as decoration  (Read 3583 times)

MRrobot

  • EA Novice
  • *
  • Posts: 12
  • Karma: +0/-0
    • View Profile
Shape Script: print TaggedValue as decoration
« 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:
  • Status_2015
  • Status_2016
  • Status_2017
  • Status_2018
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 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?
« Last Edit: October 17, 2018, 11:52:29 pm by MRrobot »

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Shape Script: print TaggedValue as decoration
« Reply #1 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

Geert

MRrobot

  • EA Novice
  • *
  • Posts: 12
  • Karma: +0/-0
    • View Profile
Re: Shape Script: print TaggedValue as decoration
« Reply #2 on: October 18, 2018, 01:21:14 am »
Thank you Geert, works perfect!

Regards MRrobo