Toad Data Modeler - Scripting & Customizations Forum - Toad Data Modeler - Toad World
Danny Torres
Follow / 1 Nov 2016 at 1:32pm / Toad Data Modeler

We are now on Twitter!!! Contact a Technical Support expert today...

Expand content
Do you have a quick support question and short of time? Contact us Via Twitter @ QuestExperts and we will take care of you. #Jointheinnovation #WeareQuest

Do you have a quick support question and short of time? Contact us Via Twitter  @QuestExperts and we will take care of you. #Jointheinnovation #WeareQuest

473 0 / Create an account to join the discussion.
3digits - Desarrollo
Follow / 7 Sep 2012 at 3:23pm / Toad Data Modeler
Latest post by on 25 Apr 2017 at 7:49am

Model remains unchanged after macro execution

Expand content
Hi, This is. Model remains unchanged after macro execution, and for example, a table is added. I have to make a "dummy" change to model and then I can save it. Regards, Biel B.
Hi,

This is. Model remains unchanged after macro execution, and for example, a table is added. I have to make a "dummy" change to model and then I can save it.

Regards,

Biel B.
11862 4 / Create an account to join the discussion.
Nicola Clement
Follow / 27 Feb 2017 at 9:44am / Toad Data Modeler
Latest post by on 28 Feb 2017 at 12:35pm

How to call Toad Data Modeler from C# application?

Expand content
I generated a TXP model using Toad Data Modeler 6.1 I launched the command: TDM.exe /regserver I written and executed automation script to perform various Toad Data Modeler tasks. How to call TDM from...

I generated a TXP model using Toad Data Modeler 6.1
I launched the command: TDM.exe /regserver
I written and executed automation script to perform various Toad Data Modeler tasks.

How to call TDM from C# application? I tried to execute the following csharp code:

{

Type toadType = System.Type.GetTypeFromProgID("TDM.App");
 dynamic App = System.Activator.CreateInstance(toadType);

while (!App.Application.IsPackagesLoaded)
 {
         Thread.Sleep(1000);
 }

var Model = App.OpenModelFromFile("C:\MyProject.txp");

 // TO DO...

}

but The server threw an exception. (Exception from HRESULT: 0x80010105 (RPC_E_SERVERFAULT)).

How can I solve this problem, anyone knows?  Thanks very much!

Regards,
Nicola

Unanswered 289 3 / Create an account to join the discussion.
Nicola Clement
Follow / 28 Feb 2017 at 10:47am / Toad Data Modeler

Where's Toad Object Library (API COM) ?

Expand content
How to automate Toad Data Modeler from Microsoft Visual C# .NET ? I need to create an Automation Client for Toad in C#. How can I do it? Thanks a lot in advance for any help, Nicola

How to automate Toad Data Modeler from Microsoft Visual C# .NET ? I need to create an Automation Client for Toad in C#.

How can I do it?

Thanks a lot in advance for any help,

Nicola

Unanswered 171 0 / Create an account to join the discussion.
sigmond
Follow / 20 Dec 2016 at 4:37am / Toad Data Modeler
Latest post by on 20 Dec 2016 at 8:39am

Workspace Properties > Select Children > Not Working?

Expand content
I am trying to add the children of an Entity to the Workspace. This is what I am doing: Right-click Workspace Click Edit Select the parent Entity Right-click the parent Entity Click Select...

I am trying to add the children of an Entity to the Workspace.  This is what I am doing:

  • Right-click Workspace
  • Click Edit
  • Select the parent Entity
  • Right-click the parent Entity
  • Click Select Children
  • Click OK

Only the original Entity that was selected is added to the Workspace.  It's children are not.

Q: What am I missing here?

369 1 / Create an account to join the discussion.
greg long
Follow / 9 Dec 2016 at 5:18am / Toad Data Modeler
Latest post by on 9 Dec 2016 at 8:46am

Seeking advice on how to prevent creation of field captions when generating...

Expand content
I've looked but haven't found any option or guidance on how to prevent the generation of field captions when creating an Access database. Use of captions in Access is a nightmare - no matter...

I've looked but haven't found any option or guidance on how to prevent the generation of field captions when creating an Access database.

Use of captions in Access is a nightmare - no matter what alias you choose to give a field in a query, Access persists in using the field's 'caption' value, if one exists. This then allows two or more query columns to have the same name - which for the unwary (like my clients) can be a  confusing show-stopper.

(Yes - I can create code that removes them once I've built the database...but happy not to explore that option. And yes, I could modify the DDL (VBA) before I run it to prevent the caption from being created.  But, I'd rather a toggle option in TOAD.)

Thanks for any advice

Greg

405 2 / Create an account to join the discussion.
mail8mz
Follow / 31 Oct 2016 at 6:04pm / Toad Data Modeler
Latest post by on 2 Nov 2016 at 3:29pm

Database development procedure

Expand content
Hello, We are using the Toad modeler and Oracle as our database development environment. There are several enviornments(development, testing, production), we have multiple release working in parallel...

Hello,

We are using the Toad modeler and Oracle as our database development environment. There are several enviornments(development, testing, production), we have multiple release working in parallel. For example, there may several drops for each Release in development environment, we need to consolidate these into one drop to testing environment. Meanwhile,  we would like the keep the consistence between the model and the production database. We are using SVN as the version control system.

Toad modeler has the function of reverse enginnering, generate DDL, merge model and etc, which makes it a good tool for such development. Is there any best practice of the procedure or toturial for such database development using Toad modeler, version control and database system?

Thanks,

784 4 / Create an account to join the discussion.
andre.furtado
Follow / 31 Aug 2016 at 2:17am / Toad Data Modeler
Latest post by on 31 Aug 2016 at 2:40pm

How to generate a TXP model from a SQL file by Automation Script?

Expand content
How to generate a TXP model from a SQL file by Automation Script? Javascript or VBScript. Cheers.

How to generate a TXP model from a SQL file by Automation Script?

Javascript or VBScript.

Cheers.

Unanswered 1162 1 / Create an account to join the discussion.
robertsg62
Follow / 21 Jul 2016 at 7:16pm / Toad Data Modeler
Latest post by on 25 Jul 2016 at 6:41am

Attempting to assign Schema to Indexes

Expand content
Hello, I have multiple workspaces under one model, where each workspace is a separate schema with tablespaces. I have been able to write a script that iterates through the indexes of an entity and assign...

Hello,

I have multiple workspaces under one model, where each workspace is a separate schema with tablespaces.  I have been able to write a script that iterates through the indexes of an entity and assign the tablespace for each based on the entities schema.  However I haven't been able to assign the schema to each index.  It is available in the drop down box on each index, but I have been unable to access it through scripting.

I have attempted to use the Scripting Reference Guide and have had some success, but not in this instance.

Database: Oracle 12c

Toad Data Model: version 5.4.6.12

Any and all assistance would be greatly appreciated.

Unanswered 1396 3 / Create an account to join the discussion.
Tommaso Sala
Follow / 15 Jul 2016 at 9:56am / Toad Data Modeler
Latest post by on 19 Jul 2016 at 9:50am

Using combobox in customized form

Expand content
Hi, I created some custom string properties in MetaModel. These properties are applied on class PERDomainOR (object type: 2006). Note: I had to use PERDomainOR (and not PERDomain) because Domain Edit...

Hi,

I created some custom string properties in MetaModel. These properties are applied on class PERDomainOR (object type: 2006).

Note: I had to use PERDomainOR (and not PERDomain) because Domain Edit Form is already customized in "Database Oracle" package, so I had to create a new package extending this one.

Then I tried to edit them via a customized form. Using a simple DataEdit textbox, they are saved and loaded correctly from my ERD model.

But If I try to use a DataStaticComboBox (in dropdown list mode, to only accept a predefined set of string values) they completely stop working.

In fact, when I select a value from the combo and then click "Apply", the value disappears.

Saving and opening my ERD model in a text editor, I can see custom property tags within each <PERDomain> node, but they are empty.

Even if I try to manually write a valid value in the XML file, when opened, the combo does not load the value.

Combo's DataSource and DataField are set the same as (working) DataEdit textbox, and StoreDirectly property is set to true.

What can I do?

If of any help, we're currently still on Toad 5.3.

1405 4 / Create an account to join the discussion.
LALIT KUMAR B
Follow / 11 Jul 2016 at 11:45am / Toad Data Modeler
Latest post by on 11 Jul 2016 at 2:38pm

Macro to rename index on foreign key

Expand content
Hi, TDM version : 6.0 Requirement: My requirement is to rename foreign key indexes with suffix based on following condition: tablename_columnname(s)_fk_i What I tried so far: I searched...

Hi,

TDM version : 6.0

Requirement:

My requirement is to rename foreign key indexes with suffix based on following condition: tablename_columnname(s)_fk_i

 

What I tried so far:

I searched the PERIndex and PERIndexItem properties, but I couldn't find the property to check the condition Index.Foreign similar to Index.Unique.

 

if (Index.Unique)
{
suffix = "_uk_i";
}

// How to rename foreign index


else if (Index.Foreign)
{
suffix = "_fk_i";
}

else

{

suffix = "_i";

}

 

Question:

How to rename the foreign index as per above code. I need to implement following rule : tablename_columnnames(s)_fk_i

 

Regards,

Lalit

Unanswered 1466 3 / Create an account to join the discussion.
LALIT KUMAR B
Follow / 7 Jul 2016 at 9:34am / Toad Data Modeler
Latest post by on 11 Jul 2016 at 6:58am

Relationships naming convention macro

Expand content
Hi, TDM version : 6.0 I am writing a macro to enforce naming conventions. I could successfully implement it for Primary keys, alternate keys, unique keys etc. I could also implement it for Relationships...

Hi,

TDM version : 6.0

I am writing a macro to enforce naming conventions. I could successfully implement it for Primary keys, alternate keys, unique keys etc. I could also implement it for Relationships, however, I am stuck on how to find the column name of the parent table it is referring to.

Let me show an example of Emp-Dept tables to explain clearly. Let's say I have the following relationship for which I am checking the naming convention as "dept_deptno_emp_deptno_fk

Example :

ALTER TABLE "scott"."dept" ADD CONSTRAINT "dept_deptno_emp_deptno_fk" FOREIGN KEY ("deptno") REFERENCES "scott"."emp" ("deptno");

The foreign key and the column name it references are same "deptno". But let's say the names are different, in such case I need the foreign key as well as the column name it is referring to, since the naming convention rule for relationships I need is:

ChildEntity_ForignKey_ParentEntity_ParentKey_FK

 

Macro:

for (i = 0; i < model.Relations.Count; i++)
{
obj = model.Relations.GetObject(i);
relationship = null;
if (obj.ObjectType == 2504) // relation line selected on
{
relationship = obj.ParentBase;
}
else if (obj.ObjectType == 2004) // relation selected
// in Model Explorer
// or Object Viewer
{
relationship = obj;
}
if (relationship != null)
{
//System.ShowMessageDialog(++dialogId, 'InfoDialog', "rel name is " + relationship.Name, 2, 4);


for (fk = 0; fk < relationship.ForeignKeys.Count; fk++)
{
constraint = relationship.ForeignKeys.GetObject(fk).KeyConstraintItem;

//System.ShowMessageDialog(++dialogId, 'InfoDialog', constraint.Name, 2, 4);

}

//System.ShowMessageDialog(++dialogId, 'InfoDialog', "the fkey index name is " + relationship.ForeignIndex.Name, 2, 4);
name = relationship.ChildEntity.Name + "_" + constraint.Name + "_" + relationship.ParentEntity.Name + "_" + <How to get the column in parent table it is referring to> + "_fk";
//System.ShowMessageDialog(++dialogId, 'InfoDialog', "new rel name is " + name, 2, 4);
relationship.Name = name;
relationship.Caption = name;
}

}

 

Question:

Relationship name : ChildEntity_ForignKey_ParentEntity_ParentKey_FK

For above relationship name, how to get the ParentKey i.e. the column in the parent table it is referring to?

Please let me know if you need more information.

Regards,

Lalit

Unanswered 1727 5 / Create an account to join the discussion.
kenatsun
Follow / 24 Apr 2016 at 10:23pm / Toad Data Modeler
Latest post by on 25 Apr 2016 at 9:48am

Customizing relationship line formats

Expand content
I need to do two things re formatting relationship lines. Can these be done, and if so, how? Provide a setting to override the convention that identifying relationships are shown as solid lines and...

I need to do two things re formatting relationship lines.  Can these be done, and if so, how?

  1. Provide a setting to override the convention that identifying relationships are shown as solid lines and non-identifying relationships are shown as dashed lines.  The identifying/non-identifying semantic/functional difference is important to capture, and I'm glad that Toad does this.  But I need to be able to show both types of relationships as solid lines.
  2. Let me modify the displayed line pattern (solid vs dashed vs whatever) for individual relationships.  In other words, provide a line pattern choice on the relationship line format dialog (which currently only lets one customize line color and weight).

If these aren't built-in options, is there a way that I could implement them in my installation by writing macros or whatever?

~ Thanks in advance, Ken

Unanswered 1780 1 / Create an account to join the discussion.
jackomino
Follow / 3 Jun 2015 at 1:21pm / Toad Data Modeler
Latest post by on 4 Apr 2016 at 12:08pm

Entity custom properties

Expand content
Good afternoon, we'd like to set additional properties to Model Entity, so that we can use them later when we create our object from Model itself: for example the information if a field can be modified...

Good afternoon, we'd like to set additional properties to Model Entity, so that we can use them later when we create our object from Model itself: for example the information if a field can be modified by application or by scripting.

Is there a chance to do this ?

Thanks a lot in advance for any help

Jackomino

Unanswered 6117 7 / Create an account to join the discussion.
martinez.astek
Follow / 22 Dec 2015 at 4:02pm / Toad Data Modeler
Latest post by on 4 Jan 2016 at 10:31am

HTML Report Customization

Expand content
Hello, I have realized a package to customize reports HTML for the database Oracle,MySQL and Sql Server. But only, few case work fine: all Oracle reports, MySQL 5.0 reports and SQL SERVER 2005 reports...

Hello,

I have realized a package to customize reports HTML for the database Oracle,MySQL and Sql Server. But only, few case work fine: all Oracle reports, MySQL 5.0 reports and SQL SERVER 2005 reports. I suppose that i have a problem with my classes which extend the default classes...

My package is join to the post. If someone can help me, i work on this for a couple of days and I am disappointed with that...


Regards

Answered 2120 2 / Create an account to join the discussion.
stones_editeurs
Follow / 8 Jul 2015 at 1:30pm / Toad Data Modeler
Latest post by on 26 Aug 2015 at 12:52pm

Script comparison

Expand content
Hello, I would like to use the script comparison to generate the differences between my tpx file and the database but I have a problem with it. For tables everything works fine but I can't find...

Hello,

I would like to use the script comparison to generate the differences between my tpx file and the database but I have a problem with it.

For tables everything works fine but I can't find the right configuration  for others objects (procedures, functions, views, ...).

I explain my problem :

- I have a procedure in my tpx file with checkbox "Generate SQL Only" checked, so I wrote all the sql code in the SQL tab. It works find and well generate the sql to create my procedure. If I change the sql in the tpx file and run the comparison it show me a difference on SQL code which is right but when I generate the script it leave the keyword "CREATE" in the SQL code so it will generate an error if I apply this script on my database.

- I have another procedure in my tpx file with checkbox "Generate SQL Only" unchecked, so I wrote only the body of the procedure in the SQL tab. If I don't change the sql in the tpx file and run the comparison it show me a difference on SQL code which is not correct but it will correctly change the 'CREATE' keyword to 'ALTER'.

What do I have to change in my tpx file to make it work correctly ?

I attached a screenshot.

Regards.

Answered 3746 9 / Create an account to join the discussion.
stones_editeurs
Follow / 6 Jul 2015 at 2:58pm / Toad Data Modeler
Latest post by on 7 Jul 2015 at 12:00pm

override system script method

Expand content
Hello, I would like to modify the sql generation script to remove comments like "-- Create tables section". I tried to create a sub script by right clicking in the script explorer (Toad Data...

Hello,

I would like to modify the sql generation script to remove comments like "-- Create tables section".

I tried to create a sub script by right clicking in the script explorer (Toad Data Modeler -> CSAO Class Definitions -> ConvertorRule Microsoft SQL Server -> ConvertorRulePEREntityMS12MS12).

In the new script I override the CreateEntity function to modify it (l.125 of the new file) : 

// Generate table comments and column comments
if (false)//(DCGenerator.CreateComments)

But it doesn't seem to work.

How can I achieve this ?

I attach a screenshot.

Regards.

Answered 3259 2 / Create an account to join the discussion.
paul.armstrong
Follow / 24 Jun 2015 at 12:09pm / Toad Data Modeler
Latest post by on 7 Jul 2015 at 10:55am

Data type script conversion

Expand content
Hi, I have a universal data model and on conversion to SQL Server 2014, I want to convert all CHAR(1) data types to BIT. I have seen the scripting capability, so it seems possible (Data Type Conversion...

Hi,

I have a universal data model and on conversion to SQL Server 2014, I want to convert all CHAR(1) data types to BIT. I have seen the scripting capability, so it seems possible (Data Type Conversion Settings dialog -> Go to Exception Script), but not quite sure where to start. If the length of the CHAR is anything greater than 1, then it should be left as is and not converted.

Thanks

Unanswered 4421 3 / Create an account to join the discussion.
Tommaso Sala
Follow / 19 Jun 2015 at 9:56am / Toad Data Modeler
Latest post by on 22 Jun 2015 at 1:39pm

RefIntegrity enum values in Toad 5.3 - 5.4 / Get Toad version from...

Expand content
It seems that the RefIntegrity enum values changed from version 5.3 to 5.4. In Toad 5.3 I discovered that: 0 -None 1 -Restrict 2 -Cascade 3 -Set Null 4 -Set Default In Toad 5.4, due to the new per...

It seems that the RefIntegrity enum values changed from version 5.3 to 5.4.

In Toad 5.3 I discovered that:

0 -None
1 -Restrict
2 -Cascade
3 -Set Null
4 -Set Default

In Toad 5.4, due to the new per-database-filtered RefIntegrity management,
the enum seems to be 1-based:

1 -No action
2 -Restrict
3 -Cascade
4 -Set Null
5 -Set Default

Note that  this is what I discovered by changing a relation and printing values... I found no documentation on this enum.

Do you confirm that?

Since I use the RefIntegrity properties in a macro, is there a way to get the current Toad version?

4723 4 / Create an account to join the discussion.
Tommaso Sala
Follow / 28 May 2015 at 1:05pm / Toad Data Modeler
Latest post by on 29 May 2015 at 12:38pm

Toad Script: Entity.Attributes[i].Domain returns undefined

Expand content
Hi I'm trying to programmatically retrieve the domain of a table's field. We only use domains in our model, as shown below: The code is the following: for (var counterAttr = 0; counterAttr...

Hi I'm trying to programmatically retrieve the domain of a table's field.

We only use domains in our model, as shown below:

The code is the following:


for (var counterAttr = 0; counterAttr < TableObject.Attributes.Count; counterAttr++)
{
var attr = TableObject.Attributes.GetObject(counterAttr);

Log.Information("Field[" +counterAttr +"]: " + attr.Name + " (" + attr.Domain + ")");
}


But unfortunately it outputs as follows:


Field[0]: LDAP_USED_GROUP_ID (undefined)
Field[1]: LDAP_DOMAIN_ID (undefined)
Field[2]: LDAP_USED_GROUP_NAME (undefined)
...

Any ideas?

Answered 6162 2 / Create an account to join the discussion.