Book a Demo

Author Topic: Copy Tagged value  (Read 5305 times)

Kezia

  • EA User
  • **
  • Posts: 33
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Copy Tagged value
« on: June 11, 2007, 01:04:45 am »
When we copy a class, why the tagged value is not copied too?
How to copy all of the tagged value?

I have tried to create a new template in XSD transformation template, called TaggedValue

Tag
{
 %TRANSFORM_REFERENCE("XSDClass")%
 name = %qt%%name%%qt%
 value = %qt%%value%qt%
}

and then call it from the Class template.

Class
{
.....
%list="TaggedValue" @separator="\n" @indent="  "%
.....
}

Not work. I'm not sure on the syntax to call tagged value, there is no documentation on how to call the name and the value of tagged value.
The documentation of EA only provide me how to call certain tagged value and its value with this syntax
%<macroName>:"<tagName>"%
Anyone can help me?

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Copy Tagged value
« Reply #1 on: June 11, 2007, 01:18:03 pm »
The templates don't (yet) provide the capability to list over the tagged values of a class (or attribute, operation, paremeter, connector or connector end).  There is also no macros to access the tagged value information apart from the tagged value construct documented.

The only way to copy tagged values using only the templates, is to know what specific tagged values you are expecting to copy.

eg.
Code: [Select]
%if classTag:"myTag1" != ""%
Tag
{
 name="myTag1"
 value=%qt%%classTag:"myTag1"%%qt%
}
%endIf%
%if classTag:"myTag2" != ""%
Tag
{
 name="myTag2"
 value=%qt%%classTag:"myTag2"%%qt%
}
%endIf%

Kezia

  • EA User
  • **
  • Posts: 33
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Re: Copy Tagged value
« Reply #2 on: June 12, 2007, 02:07:53 am »
Thanks all for the answers.

But why this code not work too, even  the tagged value exist?

[TaggedValue template]
Tag
{
 name="version"
 value=%qt%%classTag:"version"%%qt%
}

[Class Template]
Class
{
...
%list="TaggedValue" @separator="\n" @indent="  "%
...
}

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Copy Tagged value
« Reply #3 on: June 12, 2007, 01:12:00 pm »
Because there is no such thing as a list over tagged values.

http://www.sparxsystems.com.au/EAUserGuide/controlmacros.htm

Kezia

  • EA User
  • **
  • Posts: 33
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Re: Copy Tagged value
« Reply #4 on: June 12, 2007, 06:21:32 pm »
The "TaggedValue" is custom template. It should works, EA's Help tells me that %list works on custom template.

I guess that the template didn't work because I didn't specify the template type.
But when I try create an custom attribute template below, it doesn't work too. If I put Attribute_test template code to Attribute template, it works.

[Attribute_test template]
Attribute
{
 scope="Public"
 %TRANSFORM_REFERENCE()%
 %TRANSFORM_CURRENT("scope")%
}

[Class template]
Class
{
 ...
 %list="Attribute_test" @separator="\n" @indent="  "%
 ...
}

It seems that %list macro doesn't support custom template, although the EA's Help tells us it does support custom template.
Any idea what causing it?

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Copy Tagged value
« Reply #5 on: June 12, 2007, 08:48:15 pm »
Yes, it's because you didn't specify the type.

It didn't work for your attribute template because the name of the template is Attribute__test, not Attribute_test.  (Two underscores).

Kezia

  • EA User
  • **
  • Posts: 33
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Re: Copy Tagged value
« Reply #6 on: June 12, 2007, 09:59:29 pm »
Ahh.. I see..
The underscore traps me. Maybe it would be better if EA only generates one underscore instead of two underscores. The double underscore is not clearly readable.

Thanks Simon.

Cheer