Hi,
I want to write a script to automate the creation of domains (by getting them from our Oracle Designer). Where can I find the information to create new objects from a script?
Regards
Hello,
Unfortunately, there is not a complete documentation on this issue.
Current sources of information:
- Reference Guide (part of the Help documentation)
- metamodel (class object types - see details in note 2 below)
- sample scripts at:
http://modeling.inside.quest.com/kbcategory.jspa?categoryID=35
Anyway, please find attached a script for you. (I will also publish it in the Sample Script section then - for other users.)
Notes on the attached script:
var Model = app.Models.GetObject(0);
… the parameter in GetObject determines here with which model the script should work. 0 is the first model listed in the Application View. 1 is the second model listed in the Application View etc.
2006 is an domain object type. You can find out object types in metamodel of the database you work with.
-
Open your model.
-
Select a package of your database (e.g. Database Oracle package) in Package Explorer (Tools menu).
-
Right-click the Database Oracle package | Open Metamodel.
-
Find a class in metamodel (Model menu | Classes). For a domain, it will be class PERDomain or “PERDomainOR”.
-
See the Object Type. (Also when double-click the PERDomain/PERDomainOR class to open its properties dialog. On tab General, you can see the Object Type.)
GUIDs of data types can be found:
- in package DatabaseOracle10g.txg (for Oracle 10g db)
or - you can see them in a script for reverse engineering, which is a script “RE Oracle 10g” (for Oracle 10g db). Please see the GetDataType function in the script.
How to Execute Script:
- Unzip the attachment.
- Open it e.g. in Notepad.
- Copy and paste the script in the Scripting Window in TDM3. (Tools | Scripting Window).
- Run the script. (See the Execute button in the Scripting Window toolbar.)
Well, I hope this will help.
Regards,
Vladka + Mario
Add_Domain_Object.zip (463 Bytes)
Just a quick update:
The “Add Domain Object” script and a new “Add Entity Object” script are available at:
http://modeling.inside.quest.com/kbcategory.jspa?categoryID=35
The scripts were written for Oracle models, however you can modify them for your database. Please read the notes in the script description section. Thanks.
Regards,
Vladka + Mario