We create the primary key of a table via transformation templates, explicitely from the attributes template.
To do this we assign the first attribute (which is guaranteed to be labeled as "Idx") to be the primary key.
Though this operation is done first and the attribute is per definition the first in the originating PIM model the PK is always moved to the end of the attributes list. However we have to keep the modeled attribute order for various reasons.
What is the prefered way of keeping the order of the attributes especially for the primary key?
Is there a way to explicitely set the attribute position in the template?
The code in the template:
%if attName=="Idx"%
PrimaryKey
{
Column
{
%TRANSFORM_CURRENT("alias","stereotype", "collection", "constant", "containment", "ordered", "static", "volatile")%
$value=%EXEC_ADD_IN("xbadsl", "attTaggedValueFromGUID", attClassifierGUID,"SQLType")%
type=%qt%%CONVERT_TYPE(genOptDefaultDatabase,$value)%%qt%
}
}
%else%
Column
{
%TRANSFORM_CURRENT("alias","stereotype", "collection", "constant", "containment", "ordered", "static", "volatile")%
$value=%EXEC_ADD_IN("xbadsl", "attTaggedValueFromGUID", attClassifierGUID,"SQLType")%
type=%qt%%CONVERT_TYPE(genOptDefaultDatabase,$value)%%qt%
}
%endIf%
Thanks for any hints.
Oliver