Toad World® Forums

Name v Caption


#1

I am v new to TDM, however have been using a flakey version of ERWin. We use a dictionary which automatically converts Logical (Caption) to Physical (Name) this is very helpful to us as there are multiple developers and consistency is essential. Can we achieve this in TDM?


#2

Maybe TDM scripting engine may help? Try sth like this

function main(){
var i,j;
var Ent;
var Attr;

for (i=0; i<OrigModel.Entities.Count; i++)
{
Ent = OrigModel.Entities.GetObject(i);
for (j=0; j<Ent.Attributes.Count; j++)
{
Attr = Ent.Attributes.GetObject(j);
Attr.Name = Attr.Caption;

       }

}
}

just change OrigModel with the name of your project. This script is based on my own script which changes atributes names according of some policy. You’ll have to change few things to make this script work, but I hope I will give you some idea how to achive your goal.

Regards
Michal


#3

Hello,

Yes, this is possible in TDM - via scripting.

Please find attached a script that you simply run in Scripting Window (Tools menu).
Note: Expert Mode must be turned on to see the Scripting Window item in the Tools menu. - Settings | Options | General | Expert Mode.

The script converts caption of entities and attributes to physical name. Example:
Caption: Order Record
Physical Name: T_ORDER_RECORD
Result - physical name: Order_Record

How to Execute Script:

  1. Unzip the attachment.
  2. Open it e.g. in Notepad.
  3. Copy and paste the script in the Scripting Window in TDM3. (Tools | Scripting Window).
  4. Run the script. (See the Execute button in the Scripting Window toolbar.)

Note:
var Model = app.Models.GetObject(0);
//… parameter in GetObject determines with which model the script should work.
//0 = first model listed in the Application View, 1 = second model listed in the Application View etc.

See other sample scripts at:
http://modeling.inside.quest.com/kbcategory.jspa?categoryID=35

If you have any questions, please write us back. Thanks.

Regards,

Vladka + Mario (script author)
ConvertCaptionToName.zip (432 Bytes)