Sparx Systems Forum

Enterprise Architect => General Board => Topic started by: Fred Bevan on August 15, 2011, 11:33:24 pm

Title: Help with writing Transformations
Post by: Fred Bevan on August 15, 2011, 11:33:24 pm
I am struggling a bit with writing Transformation templates. In general, I am wondering if there are any better or more detailed descriptions and examples of how to write them than is found in the help?

Here is my specific question. I am trying to transform a Conceptual Data Model to a Logical Data Model. As part of the transformation, I want to change the stereotype for all attributes to “Attribute - Logical Data Model” except for attributes that currently have stereotypes of “Primary Key”, which should remain the same.

My code is below. The result I am getting is that all attributes are changed to “Attribute - Conceptual Data Model” (i.e. only the “else” code runs). Does anyone know what I am doing wrong?

Thanks,

Fred

Code: [Select]
Attribute
{
      %TRANSFORM_REFERENCE()%
      %TRANSFORM_CURRENT("stereotype")%
      %if attStereotype == "Primary Key"%      
            stereotype="Primary Key"
      %else%
            stereotype="Attribute - Logical Data Model"
      %endif%
}
Title: Re: Help with writing Transformations
Post by: Eve on August 16, 2011, 08:42:20 am
The reference in the help is fairly comprehensive, but it doesn't include examples.

If only the else clause is running for you, then I'd say that the most likely cause is that you don't have any attributes with the stereotype of "Primary Key".