Skip to Content

PowerDesigner - change selected column via vb script and save old name in extended attribute

Hi all,

I need to change column name/code of a selected column in an invoked Form, before apply/ok. Mainly, I need to keep old name/code in an extended attribute to create migration script later. Which event handler to use ? (Validate has already changed name/code, not the old one).

best regards
Brian

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

2 Answers

  • Nov 18 at 10:40 AM

    Perhaps I don`t fully understand your question, but I think you can use Validate on Column metaclass to keep the previous name (or code) of each column. You will just need two extended attributes (one is not enough). Let`s name them "old" and "oldest". Initially, they will contain the same value as column Name. During Validate event, you have to evaluate, whether Name was changed or not. You can do it by comparing "Name" and "old" attributes. And it can go in two possible ways:

    1) If it differs, meaning that Name has changed, you have to move "old" value to "oldest" attribute and then current Name value into "old" attribute. Now your "oldest" attribute contains previous Name of the column and is safely stored.

    2) If it doesn`t differ, then Name was not changed and you don`t need to do anything. Your previous column Name is still safely stored in the "oldest" attribute.

    I know this is not perfect, but I don`t know about any solution more simple than this. PD is not prepared to track history changes in this way.

    HTH,

    Ondrej

    Add comment
    10|10000 characters needed characters exceeded

  • Nov 18 at 11:08 AM

    I like Ondrej's answer, and would like to provide a variation. Create an extended sub-object called something like 'previous name', and use this in the same way as the extended attributes suggested by Ondrej. This will give you an audit trail for changes to name and code.

    Add comment
    10|10000 characters needed characters exceeded