Skip to Content
Author's profile photo Phillip Lam

Example on using Powerdesigner Transformation

Recently I got a question from several clients.

The question is how to pass extended attribute value when convert from, for example, LDM to PDM.

In this post, I’ll demonstrate using Powerdesigner transformation to fulfil the goal.

The model project.ldm (contains the extension) and pdm extension are attached at end of the article.

To use the files, download and unzip them. remove .txt .

I am on powerdesigner 16.5.5.

In project.ldm, I create an extension with an extended attribute called ALIAS for each entity.


I assign alias for each entity:

Entity name                                                      Alias

      Activity                                                        ACT

      Compose                                                    COMP

      Customer                                                    CUST

      Division                                                       DIV

      Employee                                                   EMP

      Material                                                      MAT

      Member                                                      MEMB

      Participate                                                  PART

      Project                                                        PRJ

      Task                                                           TSK

      Team                                                          TM

      Used                                                           U


I have two goals:

A)  Pass the extended attribute and its value to PDM

B)  Restore the extended attribute in PDM.

     Use alias to build foreign key constraint in PDM.

A) Let’s create a new extension.

    a) In Workspace, right click the model and select New->Extension


  b)  Right click Profile and select Add Metaclasses…

        Since the extended attribute in LDM is defined in Entity level, I must check Entity. Click OK.


  c)  An object called Entity is created. Right click Entity. Select New->Transformation.


  d) Hight the transformation. Click Transformation Script. Add the following code:

      obj.annotation = obj.getExtendedAttribute(“ALIAS”)

      What the code does is to store alias in entity’s annotation field.


  e) Click top item and select Add Items.


  f) Check Transformation Profiles. Click OK.


  g)  Click TransformationProfiles. Select New.  Profile_1 is created.


h) Highlight Profile_1 and click Pre-generation tab. Click Add Transformations icon.


i) Check the transformation we have created. Click OK.


j)  Right click Entity and go to New->Extended Attribute. Set name to ALIAS, data type to String


k) Now you can assign alias for each entity in project.ldm.  Create your own alias or use mine.

l)  Go to Tools->Generate Physical Data Model. We want to generate a new PDM


m)  Click Detail tab. Click Enable transformations button.

      Now you should see Pre-generation tab shows up. Check the transformation we just created. Click OK


n)   Once the process end, go to the PDM, double click a table to bring up its property. Click Definition tab. Click Annotation tab.

      The alias value is in there.


We have successfully passed alias value to PDM.

The key idea of this approach is that  we want to find a temporary place to store a value.  And

1) this temporary place can be passed to other type of model.

2) this temporary place can be easily modified.

3) we can easily find the owner of the temporary place.

4) our extended attribute and the temporary place has the same owner.

Clearly an object’s comment, description, annotation field match above conditions.

If these fields have already had value in it, you can add your value at beginning or end of the string, using unique delimiter.

Later on you can extract the value based on the delimiter.


In Annotation field, there is string called “this is test”. You can put alias “ACT” at end of the string using format:

      this is test>!>!>!<!<!<!<ACT

B)  Now let’s restore alias for PDM.   Open the PDM you just generated from LDM.

a) Create a new extension

b) Create an extended attribute called ALIAS in Table. Set its data type to String.


c) Right click Table and select New->Transformation.

    Add the following code:

      obj.setExtendedAttribute “ALIAS”, obj.annotation


d) Create transformation profile.  Create a post-generation.  For detail step see screenshot above in LDM section.


e) Save the change.  Go to Tools->Apply Transformations. Check the transformation you just created. Click OK


      Now all aliases are restored.


The next thing we want to do is create a transformation to build foreign key constrain using the alias.

In the PDM, go to Model->References.  The original FK constraint name is very complicated.

Our goal is use format

           Alias of child table_Alias of parent table_FK

to replace the existing ones.


All you need do is create a post-generation in object model. Write vbscript

I attach my extension file in the post.

You can import it  by create a new Extension or open existing one, clicking ExtendedDefinition_1, clicking the import items icon.

To export an extension, click Save icon.

This is how my extension looks like:


Now go to Tools->Apply Transformations.  Select your transformation. Click OK.


This is the final result:


If you modify the LDM or its extension and want to apply the change, you can do the following:

Make sure both LDM and PDM are in the workspace. Bring up LDM’s diagram.

Go to Tools->Generate Physical Data Model

Select Update existing Physical Data Model. In Detail tab, click Enable transformations button

You ‘ll see both Pre-generation and Post-generation tab. Check proper transformations in both tabs.

Click OK.


Finally, you need clear the temporary place. In our example, it’s the annotation field of the Table object.

Using previous example, you want to extract

this is a test


this is a test<!<!<!<!>!>!>!>ACT

Write vbscript using  function split and replace.

If the temporary place merely has alias, you simply reset the field to empty.

Assigned Tags

      1 Comment
      You must be Logged on to comment or reply to a post.
      Author's profile photo Rafal Kallus
      Rafal Kallus

      Hi Phillip,

      we are trying to duplicate objects during a LDM -> PDM generation. So we want to duplicate Entity_1 in PDM, so that we have Table_1_1 and Table 1_2. For this we are trying to CopyObject, but somehow, we are not able to add the created object to the model. How to do that? We can find this object in the "temporary model", but we can't add them to the target model.