Book a Demo

Author Topic: Custom DDL transformation  (Read 6301 times)

Jes

  • EA Novice
  • *
  • Posts: 11
  • Karma: +0/-0
    • View Profile
Custom DDL transformation
« on: November 28, 2015, 11:47:24 pm »
In my logical to physical model transformation, I can't figure out how would one connect an exisiting table with a newly created one - created by the transformation - using a foreign key.

How do I get the GUID of the newly created table, so that my intermediary file would reflect these in the join? See below.

part of my custom DDL transform:
Code: [Select]
table {
            ...
            PrimaryKey
            {
                  Column
                  {
                    ..
                  }
            }            
            Column
            {
                  ...
            }
      }      
      ForeignKey
      {            
            %TRANSFORM_REFERENCE("FK1",classGUID)%
            Source
            {      
                  %TRANSFORM_REFERENCE("Table",classGUID)%
                  $tabName=%CONVERT_NAME(className, "Spaced","Underscored")%
                  name=%qt%%TO_UPPER($tabName)%%qt%
                  multiplicity="1"
                  Column
                  {
                        name=%qt%%attName%%qt%
                        type=%qt%%CONVERT_TYPE(genOptDefaultDatabase,"Integer")%%qt%
                  }
            }
            Target
            {
                  %TRANSFORM_REFERENCE("Table",attGUID)%
                  Column
                  {                  
                        name=%qt%%TO_UPPER($cvAttName)%_ID%qt%
                        type=%qt%%CONVERT_TYPE(genOptDefaultDatabase,"Integer")%%qt%
                  }
            }
      }

Part of the intermediary file:
Code: [Select]
ForeignKey
      {            
            XRef{namespace="DDL IDMP" name="FK1" source="{2CA9A5E3-214F-41e4-ACF1-BCBDD795B130}"}
            Source
            {      
                  XRef{namespace="DDL IDMP" name="Table" source="{2CA9A5E3-214F-41e4-ACF1-BCBDD795B130}"}
                  name="AUTHORIZATION"
                  multiplicity="1"
                  Column
                  {
                        name="Status"
                        type="INTEGER"
                  }
            }
            Target
            {
                  XRef{namespace="DDL IDMP" name="Table" source="{EE4CB7B8-0236-46e7-A7C0-A007D608680F}"}
                  Column
                  {                  
                        name="STATUS_ID"
                        type="INTEGER"
                  }
            }
      }

The problem is that the source and target GUID above are both for the same original table and none for the newly created one.
« Last Edit: November 29, 2015, 12:06:58 am by jesc »

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Custom DDL transformation
« Reply #1 on: November 30, 2015, 08:04:16 am »
I haven't personally done it for a DDL transform, but you can replace the XRef in the Source or Target node with a guid.

ie. Instead of having
Code: [Select]
%TRANSFORM_REFERENCE("Table",classGUID)%Write
Code: [Select]
GUID=%qt%%classGUID%%qt%
This is described in the help: Transform Conectors
« Last Edit: November 30, 2015, 08:09:14 am by simonm »

Jes

  • EA Novice
  • *
  • Posts: 11
  • Karma: +0/-0
    • View Profile
Re: Custom DDL transformation
« Reply #2 on: November 30, 2015, 10:12:51 pm »
Thanks Simon,

I've tried out what you suggested, but somehow the assignment GUID = %classGUID% still referes to the original table. I otherwise expected to see a reference to the newly created table.

My setup might be wrong :(
I can't figure out the section in the guide that you point to. Can you elaborate on why the references in the target and source are still the same? Thanks in advance.

Code: [Select]
ForeignKey
      {      
            %TRANSFORM_REFERENCE("FK1",classGUID)%      
            Source
            {      
                  %TRANSFORM_REFERENCE("Table",classGUID)%
                  multiplicity="1"
                  Column
                  {
                        # FK in original table
                        name=%qt%FK_%className%_%attName%%qt%
                        type=%qt%%CONVERT_TYPE(genOptDefaultDatabase,"Integer")%%qt%
                  }
            }
            Target
            {
                  GUID=%qt%%classGUID%%qt%
                  Column
                  {            
                        # Points to the PK of new CV table
                        name=%qt%CV_%attName%%qt%
                        type=%qt%%CONVERT_TYPE(genOptDefaultDatabase,"Integer")%%qt%
                  }
            }
      }

The intermediary:
Code: [Select]
ForeignKey
      {      
            XRef{namespace="DDL IDMP" name="FK1" source="{A75C50BD-C016-4ede-A895-1AE8CEC3F535}"}      
            Source
            {      
                  XRef{namespace="DDL IDMP" name="Table" source="{A75C50BD-C016-4ede-A895-1AE8CEC3F535}"}
                  multiplicity="1"
                  Column
                  {
                        # Points to the FK to CV table in original table
                        name="FK_MarketingAuthorization_AuthorizationStatus"
                        type="INTEGER"
                  }
            }
            Target
            {
                  GUID="{A75C50BD-C016-4ede-A895-1AE8CEC3F535}"
                  Column
                  {            
                        # Points to the PK of CV table
                        name="CV_AuthorizationStatus"
                        type="INTEGER"
                  }
            }
      }

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Custom DDL transformation
« Reply #3 on: December 01, 2015, 08:19:11 am »
I provided a hyperlink to the relevant part of the help.

However, based on your comments, it looks like you have the ends reversed. To reference the original table use GUID=, to reference a newly created table use TRANSFORM_REFERENCE.

I recommend deleting your newly created table and running the transform again from scratch to ensure you're not seeing something created in an old iteration of the template.
« Last Edit: December 01, 2015, 08:20:06 am by simonm »