Package Explorer
Package Explorer displays package structure in Toad Data Modeler and allows you to:
- Manage objects saved in the packages (rename, move, copy objects, open Object Properties dialog etc.)
- Access all package Metamodels
To open Package Explorer
- Enable Expert mode: select Settings Menu | Options | General | select the Expert Mode checkbox.
- Click on the toolbar or select Expert Mode Menu | Customization | Package Explorer.
Toad Data Modeler contains packages for:
- Specific supported databases (e.g. Oracle, Microsoft SQL Server 2005, MySQL 5.0 etc.)
- Physical ER models
- Logical models
- HTML and RTF reports
- and other functions, such as SQL/DDL generation, reverse engineering etc.
The Package Explorer Tree
Via the box at the top, you can filter the list of packages.
Read-only packages/scripts cannot be edited.
Root folders contain packages that have various lists of objects, e.g.:
- Forms Definitions - contain partial definitions with a list of changed visual components of forms modified by user
- External Class Definitions- contain classes and their members designed by user (see the "Metamodel" topic)
- Package Dependencies - show dependencies between the selected package and other packages
Right-click Package options
Load Package |
Loads the package from disk to Toad Data Modeler. For faster work with packages and for faster loading of application, some information is loaded only on demand. |
Delete Package |
Deletes the selected Package and all items it contains. |
Disallow Package |
Selected package won't be loaded during next Toad Data Modeler launch. |
Export Package |
Exports the selected Package in .tbg format to the chosen folder |
Open Metamodel |
Opens the selected Package Metamodel. See Metamodels for more information. |
Extend with New Package |
Creates a new package that will extend the currently selected package. |
Create Dependent Package |
Creates a new package that will be dependent on the currently selected package (will inherit from it). |
Properties |
Contains information about the selected package and its items (General information, Visibility, Script folders, Scripts, Description). From here, you can also manage the scripts in the package - add, delete or edit them. (See the following example.)
Package File box in the Package Properties dialog - Path to the location where the package is stored. Click the button on the right to open the location in file explorer. |
Save BIN |
The selected XML package (*.txg) will be saved in binary format (*.tbg). |
Save All as BIN |
All XML packages (*.txg) will be saved in binary format (*.tbg). |
Package Explorer Toolbar
|
Save Actual - saves changes to actually active Package |
|
Save All - saves all changes made in all modified Packages |
|
Creates a new user Package. |
|
Adds an existing Package to the Package Explorer. |
|
Hides all system Packages, leaving only the user and add-on ones visible. |
Icons of Packages in Package Explorer
Type of Package/State |
Loaded |
Loaded-Modified |
Unloaded |
Disallowed |
Loaded |
Unloaded |
Disallowed |
Error during Loading |
System |
|
|
|
|
|
|
|
|
Add-On |
|
|
|
|
|
|
|
|
My Package |
|
|
|
- |
|
|
- |
|
Locked |
A package is locked when:
a) it is marked as read-only on the disk
b) it is a system package and user does not have Expert Mode enabled
|
Note: All system packages are read-only by default. However, in Expert mode it is possible to change the lock/unlock property of the package (right-click the package in Package Explorer | Properties.) Generally, in Expert mode it is possible to lock/unlock system packages and add-on packages. | |
Loaded |
Complete package has been loaded to memory. |
Loaded - Modified |
Package has been modified by user. |
Unloaded |
Package has not been loaded to memory. |
Disallowed |
Package has been disallowed by user (right-click the package in Package Explorer | Disallow Package). |
Error during Loading |
Loading of the package failed. It is an error state. This situation can happen e.g. when a dependent package of this package is missing (for example it was not selected during installation of the application).
|
Note: It is not possible to edit a script when package is locked. Unlock a package to edit its scripts. | |
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.)
- In Script Explorer, select a script that you want to modify.
- Right-click the script and select Edit Source Code.
- In the Script Editor, edit the source code directly.
- Press Commit to confirm changes, or Rollback to cancel the changes.
- 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.
- Open Script Explorer.
- Select a folder (category) where you want to add the new script.
- Right-click the selected folder and select Add New Script. -> A new item will display in the Script Explorer under the selected folder.
- Double-click the new script to open it in Script Editor.
- 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
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.
How to Create Custom Properties
To further extend the functionality of Toad Data Modeler, you can create your own custom properties for most objects. To create a new custom property:
- Right-click an object in Model Explorer and select Add Custom Property.
- New Custom Property dialog appears. Here you can configure your property. Once, you're done, restart Toad Data Modeler and your property will be created and accessible via scripting.
Caption/Name |
Logical and physical name of the property. Name is used to refer to the property in scripting. |
Level |
Determines on which level the property should be created. For example, if you create a new custom property for an entity (in Oracle 10g model), you can choose from the following options:
- PEREntityOR10 - The property can be used only in Entities in Oracle 10g models.
- PEREntityOR - The property can be used only in Entities in any Oracle models.
- PEREntity - The property can be used in all Entities.
|
Type |
Sets the custom property data type. The data type should be chosen depending on what would you like to store in the property:
- Widestring - Text strings in general, supports Unicode characters.
- String - Text strings in general, does not support Unicode characters.
- Integer - Positive/negative whole numbers.
- Boolean - True/False values.
- Real - Floating points numbers.
- Dispatch - Any Toad Data Modeler object (Entities, Attributes...)
|
Readonly |
Flags the property as Read Only, meaning its value cannot be changed. |
Script Implementation |
This option allows you to customize the way your property will behave using scripting. You should check it in two cases:
- Your custom property value will be set according to other property values - In this case, use the automatically generated Get method to get other properties values and set your custom property value according to them.
- Other properties values will be changed depending on your custom property value - This can be done using the automatically generated Set method. From there, you can change the value of any other property.
|
Package |
Determines in which Package the custom property will be stored. Loading/Disallowing the selected Package will cause the property to be usable/unavailable. |