Chat now with support
Chat with Support

Toad Data Modeler 6.3 - 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

Script Explorer

Features and Tools > Scripting and Customization > Script Explorer

In Script Explorer, you can edit existing scripts, write your own scripts/macros and more.

To open Script Explorer

  1. Enable Expert mode: select Settings Menu | Options | General | check the Expert Mode checkbox.
  2. Click on the toolbar or select Expert Mode Menu | Customization |Script Explorer.

Script Explorer doesn't contain all data that you can find in Package Explorer, but only scripts stored in folders.

Via the Script Explorer, you can:

  • Make petty modifications in user scripts - see option Edit Source Code(in New Window)
  • View source code of read-only scripts (via the Edit Source Code option as well), and copy their parts to use them in new scripts
  • Extend functionality of existing scripts and modify them significantly - see option Add New Script
  • Delete user scripts

See Scripting in Script Editor for more information.

The Script Explorer Tree

From the combo-box at the top, you can select a script for:

  • All Models
  • Physical Model
  • Specific database
  • Metamodel
  • Logical Model

Example: See the screenshot above - Microsoft SQL Server 2012 has been selected.  The scripts with visibility enabled in Microsoft SQL Server 2012 are displayed.

Options for Folders

Folders (Script Categories):

  • Constants - scripts with constants
  • CSAO Class Definitions - scripts with class definitions, mostly organized to folders with specific database names
  • Dictionaries - contains dictionary scripts
  • Form Events - contains event scripts
  • Reports - contains scripts for HTML and RTF report generation
  • Reverse engineering - contains scripts for creating a model via reverse engineering
  • Verification - contains scripts for verification

Right-click a folder to see the following options:

Option Description

Add New Script

Adds a new script under the selected folder.

Delete Folder

Deletes the selected folder, including its contents.

Folders which contain system scripts cannot be deleted - they are locked (see the padlock icon).

Add New Folder

Creates a new folder in selected folder.

Properties

Opens the Properties dialog of the selected folder  From here, you can also manage items of the folder - add, delete and edit them, provided the folder is not read-only.

General Tab

This tab contains some basic information on the folder.

Items Tab

All sub-folders and scripts of particular folder are listed on this tab. Here, you can also manage them - add, edit, delete. (Provided that they are not read-only.)

Options for Scripts

Right-click a script to see the following options:

Option Description
Create New Script Creates a new script under the selected script.

Delete Script

Deletes the selected script. If this script contains other script items, they will be deleted as well.

System scripts cannot be deleted. They are locked (see the padlock icon). It's not possible to delete other read-only scripts either.

Edit Source Code

Opens Script Editor in the Application Window.

This option is available for all scripts - user, system and read-only scripts. Note that there is a significant difference though:

  • User scripts that are not locked: You can edit the source code entirely.
  • System scripts and read-only scripts: You can only view the script and copy its parts. You cannot edit source code of such scripts directly.

Edit Source Code in New Window

Same as above, however the source code of the selected script will open in a new instance of Script Editor.

Note: You can open source code of the same script multiple times, for example when viewing different parts of a script in two windows.

If any of the Edit options is selected, the script will be locked automatically, and other modifications of this script won't be allowed. (In Script Explorer, such scripts are disabled.)

Properties

Opens the Script Properties dialog. Properties of system and read-only scripts cannot be edited.

Script Properties

General Tab

Description

Name

Physical Script name

Caption

Logical Script name

Category

Selects the script category (folder) in which it can be found.

Script Type

Select Script Type:  JScript, VBScript and Internal script are available.

Package

Name of the package where the script is stored. User scripts are stored in "My Package" by default.

Script Folder

Name of the folder in Script Explorer in which the script was created. Cannot be changed.

Visibility Tab

On this tab, you can find information about the script visibility. It defines when the script is visible when you filter scripts in Script Explorer.

Let's say your script visibility is set to "Physical Model". When you filter scripts in Script Explorer by category, your script will be shown each time the filtered category falls under Physical Model. But if you filter script by the Logical Model category, your script won't be shown.

Others Tab

Contains mostly identifying info such as Author, Company, Version etc.

Notes Tab

A tab for writing notes about the script.

Script Editor

Features and Tools > Scripting and Customization > Script Editor

Script Editor is accessible from Script Explorer or Package Explorer.

To open Script Editor

  • Right-click a script and choose Edit Source Code or Edit Source Code in New Window.

or

  • Simply double click a script/macro in Script Explorer

When you open an instance of Script Editor, the Scripts tab is displayed at the top of the Application Window. When this tab is focused, a new tab row appears. All opened scripts are shown as tabs there.

Note: Read-only scripts (system scripts and locked scripts) can be viewed only. You can still copy their code and use it in your own scripts.

Left section of Script Editor

List of functions in currently opened script.

Save

Saves changes you made in the script. (Shortcut: CTRL+S)

Rollback

Discards all changes made since the last save.

Note: Double-click a function in the left section of Script Editor to move to its source code in the editor itself.

TIP:

  • You can insert bookmarks in your code:
  1. Press CTRL+SHIFT+number 0-9 to insert a bookmark on selected row.
  2. To move to a created bookmark, press CTRL + bookmark number.
  • You can also quickly search through all of existing scripts by going to Expert Mode Menu | Customization | Find in Scripts or pressing CTRL+ALT+F.

Script Editor Right-Click Options

These are standard functions that can be used while working with scripts in Script Editor.

Convert Internal Script

Option for internal scripts that allows you to see your internal script in JScript.

Convert Internal Script 2

Option for internal scripts that allows you to see your internal script in JScript. Moreover, via this option, you can see numbers of lines that you can map in case of errors in the script.

Note: If an error occurs and it is an error in script, the script will open in Script Editor and the particular problematic line in the script will be highlighted. (Expert mode must be enabled.)

Scripting in Script Editor

Features and Tools > Scripting and Customization > Scripting in Script Editor

In Toad Data Modeler, you can create and edit scripts via Script Explorer and Package Explorer. For scripting purposes, Script Explorer should be used. (Script Explorer)

To create a new script

Select a script/folder in Script Explorer | right-click and select Create New Script.

To edit already existing script

Select a script/folder in Script Explorer | right-click and select Edit Source Code(in New Window).

In both cases Script Editor opens.

When you modify a script source code or write a new script code:

  • The particular script is locked and no other user can modify it.
  • The script is disabled in Script and Package Explorers.
  • Use Commit to save the changes and Rollback to cancel the changes in Script Editor. As soon as you press any of these buttons, the script becomes available for other users (will be unlocked automatically).

Note: After you click Commit, the changes you've made for the script will be saved within the TDM application, however they will not be saved in particular package on your disk (My Package). You can either save the package in Package Explorer, or close the application - the changes will be saved in appropriate package and on disk automatically.

Scripting Languages in Toad Data Modeler:

To make a petty script modification

(It doesn't work for read-only scripts.)

  1. In Script Explorer, select a script that you want to modify.
  2. Right-click the script and select Edit Source Code.
  3. In the Script Editor, edit the source code directly.
  4. Press Commit to confirm changes, or Rollback to cancel the changes.
  5. Save the changes in appropriate package and on your disk - Click in Package Explorer.

To modify functions of system scripts

System scripts are read-only and it's not possible to edit their source code directly. (See disabled Commit and Rollback icons in Script Editor.)

If you want to edit any functions of a system script, you have to create a new script and edit appropriate functions in it. For detailed example, please see User Guide, "Customization - Sample" chapter.

To write a new script from scratch  

In Toad Data Modeler, you can create a new script or further extend functionality of already existing scripts - user and also system scripts.

  1. Open Script Explorer.
  2. Select a folder (category) where you want to add the new script.
  3. Right-click the selected folder and select Add New Script. -> A new item will display in the Script Explorer under the selected folder.
  4. Double-click the new script to open it in Script Editor.
  5. Write or insert the scripting code to the right window. Use Commit or Rollback for saving and canceling the changes. Remember to save the changes in the package too.

Internal Scripting

Features and Tools > Scripting and Customization > Internal Scripting

In Toad Data Modeler, the following scripts are supported:

  • JScript
  • Visual Basic
  • Internal Script

Use the internal script for writing more extensive texts where only few commands are contained.

The internal script is similar to markup languages such as XML, HTML etc.

Every sign that is not a text must be marked by this sign - "#".

Key Words

  • import  
  • require
  • if
  • else
  • endif
  • script - Script function is generated. It allows users to define script type (e.g. JScript or VBScript) where the content between script and endscript commands is written.
  • endscript
  • proc - Creates a function in JScript. It is possible to define parameters here.
  • endproc -
  • call - Calls a procedure (function). It is possible to define parameters here.
  • <% - Beginning of macro.
  • %> - End of macro.
  • Forall - Executes iteration over list.
  • @ - Shows that the following text is an expression.

"script" Command

Use this command to insert to the internal script another part of a scripting language.

#script language=”{Scripting language}”

{Code of Scripting Language}

#endscript

Example:

#script language="Jscript"

function something() {

  Log.Infomation(‘My Message’);

}

#endscript

"proc" and "endproc" Command

Use this command to create a procedure that is available in internal language.

#proc

  Name([parameters])

    Code of Procedure

#endproc

Example:

  #proc

    Greetings()

      Hello

      Buy

  #endproc

"Call" Command

Use this command to call procedures defined by command "proc".

Example:

#call Greetings()

"forall" Command

Use this command if you want to execute iteration over a list. The result of the iteration should be a text.

Command syntax is the following:

#forall LIST_NAME (PARAM1, PARAM2, PARAM3, PARAM4, PARAM5 );

Example:

  #forall Model.tables('Create Table'+IterateItem.Name+'(','',GenerateColumns(),',',')' );

"<%", "%>" Command

Angled brackets with percentage insert part of internal script where JScript is used (or another scripting language). The expression is evaluated immediately.

Example:

<% if (Model.Count>0) Log.Information(‘something’); %>

"@" Command

It is similar to "<% %>", however the difference is that after the @ sign, only one expression follows.

Related Documents

The document was helpful.

Select Rating

I easily found the information I needed.

Select Rating