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:
![]()
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.)
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.
In Toad Data Modeler, the following scripts are supported:
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 - "#".
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
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
Use this command to call procedures defined by command "proc".
Example:
#call Greetings()
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(),',',')' );
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’); %>
It is similar to "<% %>", however the difference is that after the @ sign, only one expression follows.
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:
Option | Description |
---|---|
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:
|
Type |
Sets the custom property data type. The data type should be chosen depending on what would you like to store in the property:
|
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:
|
Package | Determines in which Package the custom property will be stored. Loading/Disallowing the selected Package will cause the property to be usable/unavailable. |
Scenario You would like to add an additional property to all entities which would indicate that modeling of a particular entity is not done yet and there are more things to be done before the entity is considered complete. The property could be named InProgress. Solution: Create a simple custom property and add a checkbox to Entity Properties linked to the property. Use the following steps as a guide: |
|
Note:If you have chosen Package other than My Package, you need to select Customize Form as option and choose the Package you have selected previously (step 2). This option is disabled by default. To enable it, go to Settings Menu | Options | Expert Mode and uncheck the Save the definitions the the 'My Package' option. |
|
Note: If you accidentally close some of the customization forms, go to Settings Menu | Options | Expert Mode | Editable Forms and check the appropriate option to show them again. |
|
TIP: If you want to transfer your customizations to another installation of Toad Data Modeler, simply move the package file from the Packages folder to the same folder of the target installation (e.g. "C:\Program Files (x86)\Quest Software\Toad Data Modeler 5.5\Packages\User\My Package.txg") |
© 2023 Quest Software Inc. ALL RIGHTS RESERVED. Feedback Terms of Use Privacy