Chat now with support
Chat with Support

Toad Data Modeler 6.2 - User Guide

Introduction User Interface Models and Model Objects
Physical Data Model
About Physical Data Modeling Benefits of Physical Data Model Entity Relationship Diagram Objects Basic Database Design Advanced Database Design
Universal Data Model Logical Data Model Working with Model Objects Model Properties Model Statistics
Features and Tools
Application Variables Export/Import DDL Script Generation Graphics Model Actions Print Projects Reports Reverse Engineering Scripting and Customization SQL Templates Tips and Tricks Toad for Oracle Integration Toad Intelligence Central (TIC) Integration Tools Version Control
Options and Configuration Databases
Supported Databases Connection Types by Database DB2 UDB v. 8 (LUW) DB2 v. 9 (LUW) DB2 v. 9.5 (LUW) DB2 v. 9.7 (LUW) DB2 v. 10.1 (LUW) DB2 v. 10.5 (LUW) DB2 z/OS v. 9 DB2 z/OS v.10 DB2 z/OS v. 11 Greenplum 4.1 Greenplum 4.2 Ingres 9.3 Ingres 10.0 Microsoft Access 2000/2002/2003 Microsoft Access 2007/2010 Microsoft Azure SQL Database Microsoft Azure SQL Database V12 Microsoft SQL Server 2000 Microsoft SQL Server 2005 Microsoft SQL Server 2008 Microsoft SQL Server 2012 Microsoft SQL Server 2014 Microsoft SQL Server 2016 MySQL 5.0 MySQL 5.1 MySQL 5.5 MySQL 5.6 MySQL 5.7 Oracle 9i Oracle 10g Oracle 11g Release 1 Oracle 11g Release 2 Oracle 12c Release 1 Oracle 12c Release 2 PostgreSQL 8.1 PostgreSQL 8.2 PostgreSQL 8.3 PostgreSQL 8.4 PostgreSQL 9.0 PostgreSQL 9.1 PostgreSQL 9.2 PostgreSQL 9.3 PostgreSQL 9.4 PostgreSQL 9.5 SQLite 3.7 Sybase ASE 12.5 Sybase ASE 15 Sybase ASE 15.5 Sybase ASE 15.7 SAP ASE 16.0 Sybase IQ 15.2 Sybase SQL Anywhere 11 SAP SQL Anywhere 17 Teradata 13 Vertica Database 8.0
Legal Information

Macros

Macros

Features and Tools > Scripting and Customization > Macros > Macros

Toad Data Modeler supports macros. You can use sample macros available in the Macros menu or create your own macros. You can create a macro in Package Explorer or Script Explorer and modify its properties to display the macro either in the main menu or pop-up menu (of specific object or on the Workspace etc.). Visual components for creation of macros are also available (User Forms).

Macros menu contains:

  • All - The selected macro will be applied either on all objects on all Workspaces or all objects of the active Workspace.
  • Selected Objects - The selected macro will be applied only on the selected objects on the currently active Workspace.
  • Productivity Pack
  • Rename Objects Pack

Scenario

You want to create a macro Add Attribute to PK and add this macro to pop-up menu of attributes in Model Explorer.

To create your own macro

  1. Open Script Explorer (Tools menu, Expert mode must be enabled).
  2. Right-click the Macros item and select Add New Macro.
  3. Right-click the newly created macro and select Properties.
  4. Define properties of the new macro. Remember to define its caption (macro name that will be displayed), visibility on tab Visibility (if for all databases etc.).
  5. On tab Others, you can define Undo options. It is recommended to keep the default settings.
  6. On tab Menu, you can define where you want to display the macro - in Main menu, pop-up menu or both.
    Select Add to Popup Menuand write the path name.
  7. On tab Object Types, select object types for which the macro will be available in their pop-up menu.
    Select Attribute and confirm OK.

  8. Double-click the new macro to open the Script Editor. Modify the default code at your convenience.

  9. Confirm Commit and Save.
  10. The Macros will be available accordingly.
 

Productivity Pack

Features and Tools > Scripting and Customization > Macros > Productivity Pack

Productivity pack contains three macros.

  • Add Entities
  • Add Attribute to Selected or All Entities
  • Copy Attribute to All Entities

 

Add Entities

Select Macros | Productivity | Add Entities to run the macro.

The same macro can be executed from Workspace.


New dialog opens. Specify entity captions, one per line.

Click Execute to create the new tables.

The tables will be added to your model.

In case your workspace option Autocomplete is activated the entities will appear also on our workspace.

Add Attribute to Selected or All Entities

Select Macros | Productivity | Add Attribute to Selected or All Entities to run the macro.

New dialog opens. Specify caption, name, data type and other options.

Tip: If you want to use table caption/name as prefix, type a "space" as the first character in Attribute Caption field and an underscore as the first character to Attribute Name field.

Note that if you select the Add to Key checkbox, the Not Null checkbox disappears.

In case you selected an entity, the attribute will be added to the selected entity. Otherwise the following dialog opens.

Click Yes to add attribute to all entities.

Result:

Verification: There is some basic verification of the required items.

Notes:

  • If you run the macro on entities with identically named attributes, the attribute will not be added to the entity more than once.
  • If you specify Varchar(%p1 %p2) as the data type, you need to know whether the second parameter is BYTE or CHAR. There is no verification for parameter values.

Copy Attribute to All Entities

Select an attribute in physical Model Explorer, right-click and select Macros | Copy Attribute to All Entities.

It is possible to run the macro also from Object Viewer.

Result:

Note: The attribute will be added only to the entities which don't have an identically named attribute.

Sources

You can find them in Package Explorer in section Productivity Pack | Macros.

Right-click any macro and select Edit Source Code to see JavaScript code.

Rename Objects Pack

Features and Tools > Scripting and Customization > Macros > Rename Objects Pack

Rename Objects Pack contains the following macros:

  • Rename Primary Keys
  • Rename Relationships
  • Rename Check Constraint Names
  • Rename View Relationships

Rename Primary Keys

This macro renames primary keys to PK_<tablename>.

When you create a new entity, its primary key is named Key1.

When you execute the macro, the key name and caption changes.

Notes:

  • If you select an entity, the macro will modify the primary key name and caption of the selected entity only.
  • If you need to change the prefix or if you want to use suffix, create a new macro and modify its JavaScript code accordingly.

Rename Relationships

This macro renames relationship captions and names and modifies them to:

New caption: <parenttablecaption> - <childtablecaption>

New name: <parenttablename>_<childtablename>

By default, relationships are named as Relationship1, Relationship2 etc. When you execute the macro, the following result is achieved:

Notes:

  • If you select a relationship, the macro will modify only the selected relationship, otherwise you will be asked if you want to run the macro on all relationships.
  • If multiple relationships exist between two entities, a random number will be added at the end of the relationship name.

Rename Check Constraint Names

This macro renames Table and Column check constraint names and captions.

By default, Toad Data Modeler names check constraints as CheckConstraint1,2,3 etc.

After you execute the macro, check constraints will be renamed to CHK_<tablename>_<index> and CHK_<columnname>_<index>.

Notes:

  • If you select an entity, the macro will modify check constraint names and captions of the entity and its attributes.
  • If you need to change the prefix or if you want to use suffix, create a new macro and modify its JavaScript code accordingly.

Rename View Relationships

This macro works similarly to the Rename Relationships macro.

New caption: <object1caption> - <object2caption>

New name: <object1name>_<object2name>

The macro renames existing View relationships.

Result:

Note:

  • If you select a View relationship, the macro will modify only the selected View relationship, otherwise you will be asked if you want to run the macro on all View relationships.
Related Documents

The document was helpful.

Select Rating

I easily found the information I needed.

Select Rating