Chat now with support
Chat with Support

Toad Data Modeler 7.0 - User Guide

Introduction User Interface Models and Model Objects
Physical Data Model
Entity Relationship Diagram Objects Basic Database Design Advanced Database Design
Universal Data Model Logical Data Model Working with Model Objects
Features and Tools
Application Variables Export/Import DDL Script Generation Graphics Model Actions Print Create New Project Reports Reverse Engineering Scripting and Customization About Templates Tips and Tricks Toad for Oracle Integration Toad Intelligence Central (TIC) Integration Tools Version Control
Options and Configuration Databases
Amazon Redshift 1.0 IBM DB2 LUW 9.5 IBM DB2 LUW 9.7 IBM DB2 LUW 10.1 IBM DB2 LUW 10.5 IBM DB2 LUW 11.1 IBM DB2 z/OS 10 IBM DB2 z/OS 11 Greenplum 4.1 Greenplum 4.2 Ingres 9.3 Ingres 10.0 EDB Postgres Advanced Server 10 Microsoft Access 2007/2010 Microsoft Azure SQL Database V12 Microsoft SQL Server 2005 Microsoft SQL Server 2008 Microsoft SQL Server 2012 Microsoft SQL Server 2014 Microsoft SQL Server 2016 Microsoft SQL Server 2017 MySQL 5.0 MySQL 5.1 MySQL 5.5 MySQL 5.6 MySQL 5.7 MySQL 8.0 Oracle 10g Oracle 11g Release 1 Oracle 11g Release 2 Oracle 12c Release 1 Oracle 12c Release 2 Oracle 18c Specifics - Oracle 12c Release 2 PostgreSQL 9.0 PostgreSQL 9.1 PostgreSQL 9.2 PostgreSQL 9.3 PostgreSQL 9.4 PostgreSQL 9.5 PostgreSQL 10 SQLite 3.7 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
Copyright Legal Notices

Modify Form

Back to our Oracle 10 physical model.

Edit an entity to open standard Entity Properties form.

Right-click the form and select Customize Form as...

Select a package you want to store modifications in.

The following forms and palettes will appear. Note that the Entity Properties form has dotted grid now.

In the Form Explorer, see that the form name is FmPEREntityEdit. We will need this information later.

To add a new tab to the Entity form, right-click any tab in the form and select New Page.

 

Define Caption for the new tab in Component Inspector.

Then select DataCheckBox item from the Component Palette.

And add a new checkbox to the CustomerFeedback tab.

Select the Entity item from DataSource field in the Component Inspector.

Then select ConfirmedByCustomer item from DataField.

Select DataMemo from Component Palette and add new text field (datamemo) item to the Customer Feedback tab.

Result:

Close the Entity Properties form by clicking the red X button at top of the form. Component Inspector, Component palette, Form Explorer will disappear.

Then right-click the form and select Save Form to CustomerFeedback.

New items are in the form.

For more information, see Set Default Values.

Set Default Values

How to Define Default Values

If you need to change the default value for new items, do the following:

Right-click the form (Entity Properties form in our example) and select Default Values for Class.

We want the Confirmed by customer checkbox to be selected by default for new entities.

Select property name and click the Default Value column. Then press F2 to edit the value.

Select where the definition will be stored. In our example, we need to store it into the CustomerFeedback package.

Click the dialog to confirm your selection in combo box and then confirm OK.

Done.

For more information, see Add Events.

Add Events

The following events are available in Toad Data Modeler scripting:

  • OnCreate
  • OnCheck
  • OnChange
  • OnClick
  • OnClickSilent
  • OnClose

Let's add OnCheck event to the checkbox on the Customer Feedback tab of the Entity Properties dialog. When the checkbox is selected, the text box with Notes from Customer will be visible. When the checkbox is unchecked, the text box will disappear.

In Package Explorer, select the Script folder under the CustomerFeedback package. Right-click it and select AddScript.

Set the script name to FmPEREntityEdit. - This is the name of the form we want to write the script for. See the "Modifying a Form" topic to find out where the form name is defined.

Set visibility to Oracle 10g only.

Close the window, right-click the script again and select Edit Source Code.

Add there the event function.

Code:

function DataCheckBox1OnCheck()

{

    if(DataCheckBox1.Checked == true)

        DataMemo1.Visible = true;

    else

        DataMemo1.Visible = false;

}

Explanation of items in bold.

DataCheckBox1OnCheck()

  • DataCheckBox1 - name of item that has been added to the Entity form.
  • OnCheck - name of event.

DatacheckBox1 and DataMemo1

  • Both are names of items that were added to the Entity form. Modify Form

Press Commit to confirm the script.

Result:

When the checkbox is unchecked, the text area is hidden.

If you select the checkbox, the text area will display.

For more information, see Access Property Values via Scripting Window.

Samples for Message Dialogs

Samples for Message Dialogs:

ShowMessageDialog

System.ShowMessageDialog(1004,'WarningDialog','Please select shapes on your Workspace before running the macro.',2,4);

Dialog type index

0 - warning

1 - error

2 - info

3 - confirm

4 - no icon

Dialog buttons index

0 - no button

1 - yes

2 - no

3 - yes/no

4 - ok

5 - yes/ok

6 - no/ok

7 - yes/no/ok

8 - cancel

9 - yes/cancel

10 - no/cancel

11 - yes/no/cancel….

ShowMessageDialogScript

This way you can create dialog with hyperlinks at the bottom.

var DlgParams = System.CreateObject('DialogParams');

DlgParams.Caption = 'Add Entities Info';// Name appears in Settings | Options in section Dialog Boxes.

DlgParams.DialogIndex = 202; // Unique number, must be above 200

DlgParams.Msg = 'This macro allows you to quickly add entities to your model. Specify one entity caption per line. ';

DlgParams.Msg += 'Spaces in entity captions can be converted to entity names as underscore characters. ';

DlgParams.Msg += 'For more infomation click the Help link at bottom. Do you wish to continue?';

DlgParams.Buttons = 3;

DlgParams.DlgType = 2;

DlgParams.HyperLink = 'http://www.casestudio.com/help/ProductivityPack.aspx';

DlgParams.HyperLinkCaption = 'Help';

DlgParams.ScriptName = 'AddEntitiesMacro';

if(System.ShowMessageDialogScript(DlgParams) != 6)

{

return;

}

Related Documents