Sparx Systems Forum

Enterprise Architect => Bugs and Issues => Topic started by: dannodj on January 29, 2010, 03:53:54 am

Title: Creating Attributes within Connector Template
Post by: dannodj on January 29, 2010, 03:53:54 am
Hi,
What I would like to do is create an attribute for a Foreign Key within the target end of an association.  I can see how the DDL template works, but it is creating columns, rather than attributes - I think this makes a difference.  I am trying the following code, but the Attribute tag is unexpected when I run the transform.

      Target
      {
        %TRANSFORM_REFERENCE("XSDClass",connectorDestElemGUID)%
        %TRANSFORM_CURRENT("Target","Direction", "Multiplicity","role", "Constraint")%
                  Multiplicity=%qt%$destMult%qt%
                  role=%qt%%CONVERT_NAME(connectorDestElemName,"Underscored", "Pascal Case")%%qt%
                  
                  Constraint=""
                  
                  Attribute
                  {
                        name="TESTID"
                        type="xs:integer"
                  }
      }

Can I include an attribute this way, if so how does it work in a template?
Thanks
Dan
Title: Re: Creating Attributes within Connector Template
Post by: Eve on February 01, 2010, 01:38:35 pm
Foreign keys are a special case because they link to particular columns.  You can't do this for regular connectors.  However, if you modify the class template to list over the connectors within the class type, you could add the attribute creation outside the connector from the connector template.
Title: Re: Creating Attributes within Connector Template
Post by: dannodj on February 02, 2010, 02:05:13 am
thanks, I've modified the Class template to create an attribute for specific types of association.

Cheers for the help