Page History
...
Basic Modeling Demonstrations: Add/Remove, Item, String and Attribute Editing
Code Sample | Description |
---|---|
Add Base Attributes |
...
...
Add base attributes to selected entities, which represent people. It |
...
also |
...
introduces a primary key based upon the entity's name. |
Add Definition |
...
...
Add a definition to selected entities. The definition applied to the selected entity |
...
also |
...
includes the object's name automatically, as in "My definition text + entity name +(s)". |
Add Parent Name Prefix to Propagating Key |
...
Add the entity name as a prefix to all attribute role names. It demonstrates how to use the FKColumnPair object. | |
Add Table Name Prefix Globally |
...
Add a prefix string to the names of all entities in the model. The macro opens a dialog box prompting the user for the prefix. If the current active model is logical, it |
...
assigns the prefix to all entity names. If the current model is physical, it |
...
assigns the prefix to all table names. |
Add Table Name Prefix Selectively |
...
Add a prefix string to the names of selected entities in the model. The macro opens a dialog to prompting the user for the prefix. If the current model is logical, it assigns the prefix to selected entity names. If the current model is physical, it |
...
assigns the prefix to selected table names. |
Add Table Owner Globally |
...
For physical models, this |
...
code updates the owner field in the table editor for all tables in the active model. The active model must be a physical model. |
Add View Owner Selectively |
...
For physical models, this |
...
code updates the owner field in the view editor for all selected entities. The active model must be a physical model. |
Attachment Example |
...
Export attachment data for each bound attachment for every selected table in the active model. The file name and path |
...
are: "C:\Attachment Data.txt. |
Attribute Binding Macro |
...
List all the unbound attributes/columns of all the models (logical and all physicals) and domains. |
...
You then can bound the attributes to any of listed domains by |
...
clicking the |
...
Bind |
...
...
Perform the align left |
...
operation (similar to the align buttons on the Alignment Toolbar) for all selected entities. This macro demonstrates more on how to use entity display objects. |
Auto-Color All Entities with FKs |
...
Make all entities with foreign keys purple. It |
...
first selects or highlights all entities in the current |
...
submodel. Then it |
...
makes all selected entities with foreign keys (which, in this case, are all the entities in the submodel) purple. Finally, it |
...
deselects or unhighlights all entities in the current, active submodel. This macro illustrates how to use entity objects, entity display objects, and selected objects |
...
, and how to distinguish among |
...
...
Take all the attributes from all the selected entities and add them into one newly-created entity. |
...
It include a separate function GetAveragePoint(), |
...
which gets the average x or y coordinate point among all selected entities. The second parameter determines whether to calculate the average x coordinate or the average y coordinate. |
Auto-Convert Datatype |
...
Iterate through all the selected entities and change the datatypes for all attributes which use VARCHAR to TEXT. | |
Auto-Create Data Dictionary and Bound Domain |
...
Create a new diagram, and then create a rule, default, and domain in the data dictionary. |
...
It then binds the rule and default to the domain |
...
, |
...
and then |
...
creates an entity and an attribute. Finally, it |
...
binds the domain to the attribute. |
Auto-Create Data Dictionary |
...
Quickly create a user-defined data dictionary |
...
. |
...
You can use the macro as a template to create user-defined or business-specific data dictionaries. |
...
Insert this macro into ER/Studio's ERSBasicHandlers system (specifically in the '"CreateDiagramHandler(CurDiagram As Object)" section of ERSBasicHandlers) and if the Create Handlers option is checked |
...
in ER/Studio's Automation Interface Options, this Data Dictionary |
...
is created and populated any time a user creates a new diagram. |
Auto-Create New Diagram |
...
Create a new diagram. The new diagram |
...
contains an IBM DB/2 physical model and six entities in the physical model. |
Constraint Generator |
...
Generate constraints from the defined reference values. |
...
You must define the reference values |
...
in the data dictionary of ER/Studio. The macro can select from bound attributes, all attributes, bound domains or all domains. This is chosen with the radio buttons at the bottom of the dialog. Note that you must insert the constraint |
...
into the check constraint/rule tab of the domain or attribute. |
Convert Name Case |
...
Convert the case of Attributes, Columns and Entity/Table names for the highlighted tables/Entities in the active SubModel to all upper or lower case. Works in Logical or Physical models. | |
Definition Editor |
...
List all the tables and |
...
allow the user to update the definition field for the table |
...
by pressing the |
...
Update button. There also is a list of columns for the respective table |
...
that the user can use to update the definitions for each column. This macro |
...
runs on a logical or a physical model and |
...
populates the lists accordingly. |
Domain Bindings Export to Excel |
...
List all the tables and allow the user to update the definition field for the table |
...
by pressing the |
...
Update button. There |
...
also |
...
is a list of columns for the respective table |
...
that the user can use to update the definitions for each column. This macro |
...
runs on a logical or a physical model and |
...
populates the lists accordingly. |
Domain Bindings Import from Excel |
...
Export domain bindings for all the attributes in the current model. The existing columns in the |
...
spreadsheet must be left in the same format if the bindings are going to be used to import back into a model. Note that the attribute data type is only in the |
...
spreadsheet for informational purposes when refactoring attributes and columns and assigning them to domains. |
Domain Bindings |
...
Import domain bindings from Excel. |
...
It maps domains to attributes or columns depending on the data in the |
...
spreadsheet. The macro provides an interface to select the dictionary where the domains are located and the model to search for the attributes or columns. When importing into a physical model, the |
...
spreadsheet must have the physical table and column names that match the selected physical model. When importing into the logical model, the names in the |
...
spreadsheet must match the entity and attribute names. |
Example |
...
...
...
Bring up a dialog box that shows all attributes bounded to a selected domain. It also allows the user to unbind specific attributes from the selected domain. The dialog box contains two list boxes and two buttons. The |
...
Domains list box |
...
shows all the domains in the diagram. The |
...
Bounded Attributes list box |
...
shows all the attributes bounded to the selected domain in the |
...
Domains |
...
list box. There |
...
also are an |
...
OK |
...
button and an |
...
Unbind button. |
...
Click Unbind to unbind selected attributes in the |
...
Bounded Attributes |
...
list box from the selected domain in the |
...
Domains |
...
list box. |
Export Domain Info to Excel |
...
Export the domains and their properties to |
...
Microsoft Excel. Each record in the Excel |
...
spreadsheet represents a domain from the data dictionary. |
...
You can use the spreadsheet to store domains outside of ER/Studio. |
...
You can update the domain properties |
...
in the |
...
spreadsheet and |
...
import them back into an existing model or a new model using the |
...
Import Domains From Excel |
...
macro. The columns in the |
...
spreadsheet must remain in the same order to import them properly. |
...
...
Generate an index column report for the active model in ER/Studio. Each record in the Microsoft Excel |
...
spreadsheet represents an indexed column. |
...
You can use the spreadsheet to apply naming conventions to indexes. |
...
You can read in the new index name |
...
with the |
...
Import Index Names from Excel |
...
macro from the |
...
New Index Name |
...
column in the |
...
spreadsheet. |
Metadata Import/Export and Formatting Examples
The following examples demonstrate various methods of importing and exporting model meta data with MSOffice applications such as Excel and Word. Importing has such uses as transferring spreadsheets or lists of names and attributes into your model. Exporting might be used for a presentation or report.
...
...
- Export Metadata to Excel Version 3.1
- Export Model Metadata to Excel
- Export Model Metadata to Word
- Export Object Definitions and Notes to Excel
- Export Reference Value Info to Excel
- Export Relationship Info to Excel
- Import Domains from Excel
- Import Index Names from Excel
- Import Object Definitions and Notes from Excel
- Import Reference Values from Excel
- Import Relationship Names from Excel
- Submodel Report
Pre/PostSQL Demonstrations for Selected Target Databases
- Insert Oracle Synonym in PostSQL
- Selectively Add DB2 Permissions to PostSQL
- Selectively Add MS SQL Permissions to PostSQL
- Selectively Add Oracle Permissions to PostSQL
- Selectively Add Oracle Sequence
- Selectively Add Sybase Permissions to PostSQL
Metadata Operations and Target Database Operations
Operation | Description |
---|---|
Generate Partitions |
...
...
Provides and interface to add multiple partitions to clustered indexes. A list of tables is provided. Selecting a table will load the clustered indexes to be partitioned. The storage parameters are uniform across partitions. | |
Get Related Tables |
...
Selects the related parents and/or child of the selected tables. To use the macro, lasso a group of entities on the diagram or select them in the diagram tree, and then right click on the macro to execute. Parents and children |
...
are selected depending if the option is checked. |
...
Use this macro |
...
to assist in submodel creation. |
...
Import Data Dictionary | Import Data Dictionary objects from a flat file. The imported file has to follow a specific format guidelines listed in the comments with examples. |
Index Naming |
...
Applies naming conventions to all types of indexes. It provides an option to use the selected tables or all tables. The prefix and suffix variables can be used to add company specific conventions to the beginning and/or end of the target name. The target name can be either the existing name, table name, tablespace name or database name. The tablespace and database can only be used for applicable platforms such as Oracle or DB2. Truncate parameters can also be specified to remove the first N characters or the last N characters of the target name. |
...
Use another parameter to limit the total number of characters in the target name. These are applied before the prefix and suffix are added. |
Name Foreign Constraints |
...
Prompts the user with a dialog to specify the naming convention for Foreign Constraints. It |
...
then |
...
names all of the constraints using the parent and child table names |
...
and makes sure that the name is unique by adding an index for the last characters of duplicate names. |
Name Primary Constraints |
...
Names all primary key constraints with the given naming conventions. The table name with either a prefix or suffix |
...
. |
...
...
Outputs DDL for primary and foreign constraints for all selected tables. To operate, selected the desired tables, then right-click on the macro to execute. The DDL can be previewed or written to a file. | |
Selectively Update Oracle Index Storage |
...
Provides a list of tables from the active physical model. The tables in the right box will be updated with the specified storage parameters. Tables can be added and removed from the updated list. | |
Selectively Update OS390 Table Storage |
...
Provides a list of tables from the active physical model. The tables in the right box will be updated with the specified storage parameters. Tables can be added and removed from the updated list. | |
SQL Server Storage Update |
...
Updates SQL Server storage parameters for tables and indexes. | |
Switch Domain Bindings |
...
Scans all the columns and attributes in the active model or all models and switches the domain bindings from the source domain to the target domain. The information for each bound column will be updated with the target domain. Any domain overrides will be preserved. | |
Update DB2 OS390 Index Storage Parameters |
...
Provides a list of tables from the active physical model. The tables in the right box will be updated with the specified storage parameters. Tables can be added and removed from the updated list. | |
Update DB2 OS390 Table Storage Parameters |
...
Provides a list of tables from the active physical model. The tables in the right box will be updated with the specified storage parameters. Tables can be added and removed from the updated list. |