Toad World® Forums

Macro-Language and/or Automation in Toad Data Modeler

Hi,

please excuse my english… anyway i will try to describe my problem/question:

Does there exist a kind of Macros or a possibility to automize work with models in Toad DM?

For example: We use Domain-based Datatypes in very many attributes in very many tables. To change the Datatype for those attributes by changing the domain is no problem; i just have to modify the domain (datatype, default-value etc.) in a single step; so far no automation neccessary.
My problem is as follows: I don’t just have to modify an existing domain, but i have to change the assignment between a domain and more than hunded attributes which use that domain to another domain.

How can i do that quickly? Manually i could open several tables and hundreds of attributes an change the assignment e.g. from “MyDomain” to “MyNewDomain”. Is there a way to use a kind of “Macro” for that?
As a “workaround” i changed the technical “id” in the .txp-File to the “id” of “MyNewDomain”. That worked when i re-opened the model.

Any better recommendation? Please note that in my special case i can’t just modify the existing domain but i have to change the assignment.

Beside the described problem a kind of automation could be useful for several other constellations too.

I hope you can relate to my problem. Thank you very much for giving me a hint!
Kind regards,

Christian

Hi,

do you wish to change domain assignments (from MyDomain to MyNewDomain) for all existing attributes or do you wish to change the domain only for selected attributes?

This can be automated, but it is necessary to know if you should select entities or select attributes and execute the macro on such objects or if you are OK with changing the assignment for all objects in you model…

Regards,

Vaclav

Hi,

thank you for your quick reply.
You are right, as you assumed it may be that not every occurency of “MyDomain” should be changed to “MyNewDomain” but only for selected attributes in selected entities.
In this case also my “workaround” with using a search-and-replace-Pattern on the .txp-File in a simple text-editor wouldn’t work.

Is there a possibility to create a macro which changes the assignment for all entities or attributes which start with a special prefix like “MyTable_…”?

Thank you very much for a (short) explanation.
Kind regards,

Christian

Hi,

thanks for the info. I will provide more information tomorrow. I will create a sample macro that will allow you to select entities or attributes and change domain. I will also write you how to do a quick select of tables using some prefix. Please expect another message from me tomorrow. Thanks.

Vaclav

Hi,

I took me more time to develop the macro. Please find the package here:
http://modeling.inside.quest.com/entry!default.jspa?categoryID=34&externalID=4812

Description:
The macro allows you to change existing domain for selected attributes in Physical Model Explorer or Object Viewer or in selected entities on Workspace, Physical Model Explorer or Object Viewer.

To run this macro, make a selection, right click any of selected items and choose Macros | Change Domain… New dialog opens. Select existing domain and new domain and click Execute.

How to install custom packages:
http://blogs.inside.quest.com/modeling/2010/10/21/how-to-import-custom-packages/

Regards,

Vaclav