Book a Demo

Author Topic: Database Foreign Key Transform  (Read 4843 times)

Owl Saver

  • EA User
  • **
  • Posts: 37
  • Karma: +0/-0
  • Never give up.
    • View Profile
Database Foreign Key Transform
« on: August 24, 2006, 09:15:41 pm »
I work with databases. One thing I need often is multiple relationships to the same table. I am tring to use EA's transform to DDL to suppor this. I have modified the ForeignKey transform as shown below. This results in two attributes based on the name. But there is only one FoerignKey method. It is based on the name of the two clasess. Does anyone know what I need to do to get the ForeignKey mentod name to change?

Thanks


$connectorGUID=$parameter1
$sourceGUID=$parameter2
$destGUID=$parameter3
$destName=$parameter4
$referenceName=$parameter5
$connectorName=$parameter6

ForeignKey
%PI="\n  "%
{
%TRANSFORM_REFERENCE($referenceName,$parameter1)%
notes=%qt%This is a note%qt%
name=%qt%Argh%qt%
Source
{
 %TRANSFORM_REFERENCE("Table",$parameter2)%
 Column
 {
   name=%qt%%CONVERT_NAME($parameter4, "Pascal Case","Camel Case")%%CONVERT_NAME($parameter6, "Pascal Case","Camel Case")%ID%qt%
   type=%qt%%CONVERT_TYPE(genOptDefaultDatabase,"Integer")%%qt%
 }
}
Target
{
 %TRANSFORM_REFERENCE("Table",$destGUID)%
 Column
 {
   name=%qt%%CONVERT_NAME($parameter4, "Pascal Case","Camel Case")%ID%qt%
   type=%qt%%CONVERT_TYPE(genOptDefaultDatabase,"Integer")%%qt%
 }
%PI="\n"%
}
}

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Database Foreign Key Transform
« Reply #1 on: August 24, 2006, 09:37:02 pm »
If you put a name in the Source end of the foriegn key, that will name the foreign key.  A name in the target end will Name the primary key at the other end, as will a name in the PrimaryKey context.

You just have to be using the 6.5 beta.  It wasn't possible in 6.1.

thomaskilian

  • Guest
Re: Database Foreign Key Transform
« Reply #2 on: August 25, 2006, 04:30:44 am »
Ah! I should try that now, since I missed it ever since.

Owl Saver

  • EA User
  • **
  • Posts: 37
  • Karma: +0/-0
  • Never give up.
    • View Profile
Re: Database Foreign Key Transform
« Reply #3 on: August 25, 2006, 07:32:43 am »
I may be missing something. I have EA 6.5 Beta 2. I have Class 1 and Class 2. There are two Foreign Keys between them, intitally, they are both called FK_Class1_Class2. Class 1 has 2 foreign key columns (class2FromID and class2ToID). Class 1 has 1 Foreign Key Method (FK_Class1_Class2). Based on your note, I:

- Right clicked on one of the Foreign Key lines
- Selected Association Properties...
- Selected the Source Role Tab
- Changed the value from 'FK_Class1_Class2' to 'FK_Class1_Class2to'
- Repeat for the other Foreign Key but changed the name to 'FK_Class1_Class2from'

After all this, the Class1 still only has one foreign key method.

Am I doing something wrong? I would like to get this into the transform process since I have a large class model with many of these types of relationships.

Take Care
« Last Edit: August 25, 2006, 07:33:19 am by michaelwacey »

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Database Foreign Key Transform
« Reply #4 on: August 27, 2006, 03:17:18 pm »
Yes, all that was added was the ability to specify this in the transformation.  The templates haven't been changed to specify where those names should come from.

Owl Saver

  • EA User
  • **
  • Posts: 37
  • Karma: +0/-0
  • Never give up.
    • View Profile
Re: Database Foreign Key Transform
« Reply #5 on: September 05, 2006, 12:20:30 pm »
Does this mean that I can modify the templates locally? If so, what do I need to set? By 'transformation' do you mean the macros that can be used in templates? Or, do you mena something else?

Thanks

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Database Foreign Key Transform
« Reply #6 on: September 05, 2006, 03:05:51 pm »
What changed was that the parser for what you generate with the templates will now accept a name and use to name the corresponding operation.