ERwinAPI TutorialSpreadsheet
ERwinAPI TutorialSpreadsheet
This spreadsheet uses MS Excel and VBA (Visual Basic for Applications) to provide example
provide a framework for creating custom ERwin API applications. Over ninety percent of ER
The data in this spreadsheet is setup to work with Entities and Attributes found in the eMovies sample model. You may m
they have when the API is run. The "Ingnore Case" version of the example will create attributes that are not found. So if
the attributes, however, this example does not recreate the Primary Keys.
Tip:
Use these examples in conjunction with the original eMovies model and with:
eMovies_API_Tutorial.erwin
NOTES:
The intent of these examples is to show the principles involved in creating an ERwin API
application. These examples happen to be written in VBA but the concepts are generic
and will apply no matter what language is used to create the API. There are some
syntactic differences with each language, but describing those differences is beyond
the scope of this tutorial.
The ERwin API exposes a standard COM interface so an ERwin API application may be
written using any language which supports COM. Implementation of a COM interface
varies from language to language so it is up to the user to determine the configuration
of that interface using the language of their choice.
Tutorial Spreadsheet
ons) to provide examples of using the ERwin API (also known as SCAPI). These examples demonstrate the ba
ver ninety percent of ERwin API applications may be written using only the functions included in these examp
es sample model. You may modify the values in the spreadsheet to see the effect
utes that are not found. So if all attributes are removed, that function will restore
For Help with the Visual Basic Editor, on the Help menu, click
Microsoft Visual Basic Help, or press F1.
Before you edit a macro, you should be familiar with the Visual Basic Editor. The
Visual Basic Editor can be used to write and edit a macro that is attached to a
Microsoft Office Excel workbook.
as SCAPI). These examples demonstrate the basics of using the ERwin API and
sing only the functions included in these examples .
NOTE: You should have only one reference to EAL.dll so only one ERwin Script
Client API component should be selected.
CA ERwin Data Modeler API - RESET P
This utility will Reset the Specified Object
Properties
Enter values below then press the button →
Property Value:
Left(scObject.Properties(sPropertyName).Value, 4) = "SYS_"
PI - RESET PROPERTY
ified Object Press
Press This
This Button
Button
to
to
e button →
RESET
RESET Object
Object
Properties
Properties
← Enter the name of the object that has the property you want to reset
← Enter the name of the property to reset (target property)
← Enter the new property value
(leave blank to remove the property)
Click the Arrow to Update Your Model
CASE-SENSITIVE
Rename Only
Entity Attribute
Existing Name Existing Name
CUSTOMER customer number
customer address
email
customer city
customer first name
customer last name
customer state
customer zip code
CUSTOMER CREDIT customer number
credit card
credit card exp
status code
EMPLOYEE employee number
supervisor
employee first name
employee address
employee address 2
employee phone
soc sec number
hire date
salary
email
store number
MOVIE movie number
movie title
movie director
description
star 1 name
rating
star 2 name
genre
rental rate
movie url
movie clip
MOVIE COPY movie copy number
movie number
general condition
movie format
MOVIE RENTAL RECORD rental record date
movie copy number
movie number
employee phone
soc sec number
customer number
rental date
due date
rental status
payment transaction number
overdue charge
rental rate
MOVIE_STORE movie number
store number
PAYMENT payment transaction number
payment type
payment amount
payment date
payment status
employee number
customer number__1214
customer number
check bank number
check number
epay vendor number
epay account number
credit card number
credit card exp
credit card type
STORE store number
store manager
store address
store address 2
store phone
store city
store state
store zip code
Attribute Column
New Name New Name
CUSTOMER-customer number COL_customer_number
CUSTOMER-customer address COL_customer_address
CUSTOMER-email COL_email
CUSTOMER-customer city COL_customer_city
CUSTOMER-customer first name COL_customer_first_name
CUSTOMER-customer last name COL_customer_last_name
CUSTOMER-customer state COL_customer_state
CUSTOMER-customer zip code COL_customer_zip_code
CUSTOMER CREDIT-customer number COL_customer_number
CUSTOMER CREDIT-credit card COL_credit_card
CUSTOMER CREDIT-credit card exp COL_credit_card_exp
CUSTOMER CREDIT-status code COL_status_code
EMPLOYEE-employee number COL_employee_number
EMPLOYEE-supervisor COL_supervisor
EMPLOYEE-employee first name COL_employee_first_name
EMPLOYEE-employee address COL_employee_address
EMPLOYEE-employee address 2 COL_employee_address_2
EMPLOYEE-employee phone COL_employee_phone
EMPLOYEE-soc sec number COL_soc_sec_number
EMPLOYEE-hire date COL_hire_date
EMPLOYEE-salary COL_salary
EMPLOYEE-email COL_email
EMPLOYEE-store number COL_store_number
MOVIE-movie number COL_movie_number
MOVIE-movie title COL_movie_title
MOVIE-movie director COL_movie_director
MOVIE-description COL_description
MOVIE-star 1 name COL_star_1_name
MOVIE-rating COL_rating
MOVIE-star 2 name COL_star_2_name
MOVIE-genre COL_genre
MOVIE-rental rate COL_rental_rate
MOVIE-movie url COL_movie_url
MOVIE-movie clip COL_movie_clip
MOVIE COPY-movie copy number COL_movie_copy_number
MOVIE COPY-movie number COL_movie_number
MOVIE COPY-general condition COL_general_condition
MOVIE COPY-movie format COL_movie_format
MOVIE RENTAL RECORD-rental record date COL_rental_record_date
MOVIE RENTAL RECORD-movie copy number COL_movie_copy_number
MOVIE RENTAL RECORD-movie number COL_movie_number
MOVIE RENTAL RECORD-employee phone COL_employee_phone
MOVIE RENTAL RECORD-soc sec number COL_soc_sec_number
MOVIE RENTAL RECORD-customer number COL_customer_number
MOVIE RENTAL RECORD-rental date COL_rental_date
MOVIE RENTAL RECORD-due date COL_due_date
MOVIE RENTAL RECORD-rental status COL_rental_status
MOVIE RENTAL RECORD-payment transaction number COL_payment_transaction_number
MOVIE RENTAL RECORD-overdue charge COL_overdue_charge
MOVIE RENTAL RECORD-rental rate COL_rental_rate
MOVIE_STORE-movie number COL_movie_number
MOVIE_STORE-store number COL_store_number
PAYMENT-payment transaction number COL_payment_transaction_number
PAYMENT-payment type COL_payment_type
PAYMENT-payment amount COL_payment_amount
PAYMENT-payment date COL_payment_date
PAYMENT-payment status COL_payment_status
PAYMENT-employee number COL_employee_number
PAYMENT-customer number__1214 COL_customer_number__1214
PAYMENT-customer number COL_customer_number
PAYMENT-check bank number COL_check_bank_number
PAYMENT-check number COL_check_number
PAYMENT-epay vendor number COL_epay_vendor_number
PAYMENT-epay account number COL_epay_account_number
PAYMENT-credit card number COL_credit_card_number
PAYMENT-credit card exp COL_credit_card_exp
PAYMENT-credit card type COL_credit_card_type
STORE-store number COL_store_number
STORE-store manager COL_store_manager
STORE-store address COL_store_address
STORE-store address 2 COL_store_address_2
STORE-store phone COL_store_phone
STORE-store city COL_store_city
STORE-store state COL_store_state
STORE-store zip code COL_store_zip_code
CUSTOMER CREDIT
EMPLOYEE
MOVIE
MOVIE COPY
MOVIE_STORE
PAYMENT
STORE
Click the Arrow to Open a Model and Update the Spreadsheet
CASE-SENSITIVE
Find Table & Column Names
umn Names
Physical names (Table & Column names) are read from the model and written bel
Physical Names (read from model)
Table
ames) are read from the model and written below
Names (read from model)
Column
This function will:
DELETE ALL OBJECTS SPECIFIED BELOW
from the selected ERwin Model
Press
Press This
This Button
Button
to
to
DELETE
DELETE ALL
ALL
SPECIFIED
SPECIFIED
OBJECTS
OBJECTS
from
from the
the selected
selected
Model
Model
CA ERwin Data Modeler API - Harde
HARDEN DATATYPES
I - Harden Datatypes
Entity Attribute
eMovies Name eMovies Name
CUSTOMER customer number
customer address
email
customer city
customer first name
customer last name
customer state
customer zip code
CUSTOMER CREDIT customer number
credit card
credit card exp
status code
EMPLOYEE employee number
supervisor
employee first name
employee address
employee address 2
employee phone
soc sec number
hire date
salary
email
store number
MOVIE movie number
movie title
movie director
description
star 1 name
rating
star 2 name
genre
rental rate
movie url
movie clip
MOVIE COPY movie copy number
movie number
general condition
movie format
MOVIE RENTAL RECORD rental record date
movie copy number
movie number
employee phone
soc sec number
customer number
rental date
due date
rental status
payment transaction number
overdue charge
rental rate
MOVIE_STORE movie number
store number
PAYMENT payment transaction number
payment type
payment amount
payment date
payment status
employee number
customer number__1214
customer number
check bank number
check number
epay vendor number
epay account number
credit card number
credit card exp
credit card type
STORE store number
store manager
store address
store address 2
store phone
store city
store state
store zip code
Attribute Column
Modified Name Modified Name
CUSTOMER-customer number COL_customer_number
CUSTOMER-customer address COL_customer_address
CUSTOMER-email COL_email
CUSTOMER-customer city COL_customer_city
CUSTOMER-customer first name COL_customer_first_name
CUSTOMER-customer last name COL_customer_last_name
CUSTOMER-customer state COL_customer_state
CUSTOMER-customer zip code COL_customer_zip_code
CUSTOMER CREDIT-customer number COL_customer_number
CUSTOMER CREDIT-credit card COL_credit_card
CUSTOMER CREDIT-credit card exp COL_credit_card_exp
CUSTOMER CREDIT-status code COL_status_code
EMPLOYEE-employee number COL_employee_number
EMPLOYEE-supervisor COL_supervisor
EMPLOYEE-employee first name COL_employee_first_name
EMPLOYEE-employee address COL_employee_address
EMPLOYEE-employee address 2 COL_employee_address_2
EMPLOYEE-employee phone COL_employee_phone
EMPLOYEE-soc sec number COL_soc_sec_number
EMPLOYEE-hire date COL_hire_date
EMPLOYEE-salary COL_salary
EMPLOYEE-email COL_email
EMPLOYEE-store number COL_store_number
MOVIE-movie number COL_movie_number
MOVIE-movie title COL_movie_title
MOVIE-movie director COL_movie_director
MOVIE-description COL_description
MOVIE-star 1 name COL_star_1_name
MOVIE-rating COL_rating
MOVIE-star 2 name COL_star_2_name
MOVIE-genre COL_genre
MOVIE-rental rate COL_rental_rate
MOVIE-movie url COL_movie_url
MOVIE-movie clip COL_movie_clip
MOVIE COPY-movie copy number COL_movie_copy_number
MOVIE COPY-movie number COL_movie_number
MOVIE COPY-general condition COL_general_condition
MOVIE COPY-movie format COL_movie_format
MOVIE RENTAL RECORD-rental record date COL_rental_record_date
MOVIE RENTAL RECORD-movie copy number COL_movie_copy_number
MOVIE RENTAL RECORD-movie number COL_movie_number
MOVIE RENTAL RECORD-employee phone COL_employee_phone
MOVIE RENTAL RECORD-soc sec number COL_soc_sec_number
MOVIE RENTAL RECORD-customer number COL_customer_number
MOVIE RENTAL RECORD-rental date COL_rental_date
MOVIE RENTAL RECORD-due date COL_due_date
MOVIE RENTAL RECORD-rental status COL_rental_status
MOVIE RENTAL RECORD-payment transaction number COL_payment_transaction_number
MOVIE RENTAL RECORD-overdue charge COL_overdue_charge
MOVIE RENTAL RECORD-rental rate COL_rental_rate
MOVIE_STORE-movie number COL_movie_number
MOVIE_STORE-store number COL_store_number
PAYMENT-payment transaction number COL_payment_transaction_number
PAYMENT-payment type COL_payment_type
PAYMENT-payment amount COL_payment_amount
PAYMENT-payment date COL_payment_date
PAYMENT-payment status COL_payment_status
PAYMENT-employee number COL_employee_number
PAYMENT-customer number__1214 COL_customer_number__1214
PAYMENT-customer number COL_customer_number
PAYMENT-check bank number COL_check_bank_number
PAYMENT-check number COL_check_number
PAYMENT-epay vendor number COL_epay_vendor_number
PAYMENT-epay account number COL_epay_account_number
PAYMENT-credit card number COL_credit_card_number
PAYMENT-credit card exp COL_credit_card_exp
PAYMENT-credit card type COL_credit_card_type
STORE-store number COL_store_number
STORE-store manager COL_store_manager
STORE-store address COL_store_address
STORE-store address 2 COL_store_address_2
STORE-store phone COL_store_phone
STORE-store city COL_store_city
STORE-store state COL_store_state
STORE-store zip code COL_store_zip_code