Skip to Content

Boiler plate text on a table and column comment in PowerDesigner Physical Data model

How do I create a boiler plate text in a Power Designer physical data model, for each new Table and a column that I create.

In Erwin, I can create Domains with standard data type and a comment which when then attached to a column, it cascades down the boiler plate text in the domain, down to the Column comment.

I would like something similar here. I tried creating a domain and attaching to a column, but the Comment(or in the Definition) text of Domain does not move down to the Column comment.

Add comment
10|10000 characters needed characters exceeded

5 Answers

  • Best Answer
    Posted on Jun 23 at 11:33 AM

    Hi Navin,

    on the screenshot attached you have everything necessary to achieve following functionality. Each time you attach a domain to a column (or do any other modification of the column) it will verify, whether the comment of column and attached domain are the same. And if they are not equal, it will propagate the domains comment into to comment of the column. If you need something more (like automatically propagate change of domains comment into all already attached columns), you will have to define that handler differently. Contact me if you need some more help with this.


    pd.jpg (762.9 kB)
    Add comment
    10|10000 characters needed characters exceeded

    • If you don't want to use an Event handler that fires every time you need to look at the Comment property, you could consider a custom check with an automatic fix - it could replace an empty Column Comment with a copy of the Domain Comment. That also allows you to edit a Column Comment without it being automatically changed back.

  • Posted on Jun 24 at 08:57 PM

    Yes, putting it into Custom check and AutoFix is definitely one of possible solutions. Nothing will happen without your control. But it happens ex-post, after you invoke it. Handlers can act in real-time and you don`t have to pay attention to it. You just have to handle all possible scenarios that can ocurr.

    Using Custom check and autofix might be easier to implement, but you have to pay more attention to it during modelling time. Handler is more like implement & forget. But it might be more complicated to implement it.

    Regardless of which solution you choose, good luck with your modelling.

    Add comment
    10|10000 characters needed characters exceeded

  • Posted on Jun 23 at 03:19 PM

    Thank you Ondrej, that worked !!

    How do I make this code independent of a data model ? Can these be saved outside and then any *New* PDM I generate inherits this code.


    I don't fully understand the alternative you mention.

    Honestly, Erwin makes this as easy as clicking a button called Domain Inheritance. By default everything about the domain is inherited into the column with an option to overwrite anything you want at column level or sync back to a domain. In PD, they decided to implement the datatype and length to be inherited, but nothing else. In Erwin, I use the Domains to even implement classwords down at the column level with this functionality.

    PD gives lot of flexibility, but it is expecting a Data Modeler to learn and write VBScript.

    Add comment
    10|10000 characters needed characters exceeded

    • Just open the extension you created according to my advice and use Save As function. It will create new *.xem file which stores your extension. And then you can attach it to all models needed (you can do that through menu Model - Extensions...). And if you go to the very root level in your extension and set the "Auto attach" boolean option to true, this extension will be automatically attached to every new data model you create. Nice and easy.

      And regarding learning VBScript. Actually only scripting can give you the oportunity to use everything PowerDesigner can offer. This customizability and extensibility outperforms Erwin overwhelmingly. And if you don`t want to waste your time with VBScript, this is where I can help you. Just let me know.

      Please mark my answer as accepted if all your questions have been answered.



  • Posted on Jun 23 at 09:04 PM

    Thanks Ondrej.

    One more question, after reading what George wrote.

    If I edit the Column level meta-data, this rule keeps triggering and putting back the template from Domain back, wiping out my column level comment modifications. Just wondering if I should change first line to check if Column comment is NULL

    If not (obj.Domain is Nothing) and Obj.Comment is Nothing

    Add comment
    10|10000 characters needed characters exceeded

    • Yes, of course. My advice was initial step, you will probably have to tailor it to your needs and implement additional logic. Just please don`t test the emptiness of a comment with "is Nothing" statement. That is used for object properties. The whole command in your case would be:

      If not (obj.Domain is Nothing) and obj.Comment = ""

      or you can use:

      If not (obj.Domain is Nothing) and Len(obj.Comment) = 0
  • Posted on Jun 24 at 01:43 PM

    I had to remove the code from Event Handler as it was wiping out my custom modifications.

    I have put it as a Custom Checks and under AutoFix Script as I finally understood what George was referring to.

    But I realize now doing this VB Scripting without fully understanding the implications is not going to give me the desired results.

    Will have to read up and experiment later as currently busy with deliverable deadlines.

    This is what I have in Autofix script

    Function %Fix%(obj, outmsg)

    ' Implement your automatic correction on <obj> here

    ' filling <outmsg> as you wish

    ' and return True if successful. outmsg = "Automatic correction not implemented"

    If not (obj.Domain is Nothing) and Len(obj.Comment) = 0 then

    If Obj.Domain.Comment <> Obj.Comment then Obj.Comment = Obj.Domain.Comment

    End If

    End If

    %Fix% = False

    End Function

    Add comment
    10|10000 characters needed characters exceeded