views:

127

answers:

2

Hello,

I have a relatively large Conceptual Data Model in PowerDesigner. After generating a Physical Data Model and seeing the DBMS data types, I need to update all of data types(NUMBER/TEXT) for each data item.

I'd like to either do a find/replace within the Conceptual Data Model or somehow map to different data types when creating the Physical Data Model. Ex. Change the auto conversion of Text -> Clob, to Text -> NVARCHAR(20).

Thanks!

+2  A: 

I don't know of a 'standard' find & replace, but this will work just the same. Have you ever ran VBScript against one of your models? If not, let me know, but if so, give one of these a try:

For the Conceptual Model:

Set mdl=ActiveModel

FOR EACH TAB IN MDL.Entities
   IF (not tab.isShortcut) THEN
      FOR EACH COL IN TAB.ATTRIBUTES
         IF COL.DATATYPE = "TXT" THEN
            COL.DATATYPE = "VA20"
         END IF
      NEXT
   END IF
NEXT

Basically, it will look at all the attributes of all your entities, and if the datatype is 'TXT' (Text), it will change it to be 'VA20' (Variable Character (20)).

For the physical model:

Set mdl=ActiveModel

FOR EACH TAB IN MDL.Tables
   IF (not tab.isShortcut) THEN
      FOR EACH COL IN TAB.COLUMNS
         IF COL.DATATYPE = "TEXT" THEN
            COL.DATATYPE = "NVARCHAR(20)"
         END IF
      NEXT
   END IF
NEXT
Zerofiz
No, I haven't run a VBScript against a model yet, but this is exactly what I was looking for. However...I just registered the product as the developer version and no longer can create Conceptual Models and I'm left with my Physical Model. There are no MDL.Entities in the Physical Model and I don't see anything similar. Thoughts?"Object doesn't support this property or method: 'mdl.Entities' (0x800A01B6)At line 3"
Andy
I'll edit with the Physical version...
Zerofiz