Working with Data Models › Macro Toolbox › Macro Syntax
Macro Syntax
The CA ERwin DM macro syntax commands are composed of keywords, punctuation, and parameters.
- Keywords always start with a percent sign (%) and must be entered exactly as shown.
- Punctuation includes braces {}, parentheses (), and commas. You use: braces to specify results, what you want to do based on the keyword and the parameters; parentheses to specify parameters, and commas to separate parameters if you include more than one parameter in a command. To display the expanded code in a list, place the end brace on a new line in the syntax, as shown below.
Syntax Example
|
Expansion
|
%ForEachAttribute() { %If{ %ColIsFK} %AttName }
|
master-number movie-copy-number
|
- Parameters are shown in angle brackets. You can replace parameters with your own text, number, SQL code, or other CA ERwin DM macros by typing the macro command in a trigger, stored procedure, or script.
Here is an example of syntax at work using the %ChildAtts macro:
- %ChildAtts
-
Lists all the attributes of the child entity in a relationship and performs the specified action on each one.
- Full Syntax
-
%ChildAtts(<separator>,<action>, <prefix>)
- Full Syntax Example
-
/*If the current relationship is <is in stock as>, then */
%ChildAtts(" or ",update)
- Expansion
-
update(movie_copy_number) or
update(master_number) or
…
- Usage
-
Relationship macro-can be used in RI or Rel Override.
The following provides a graphical display of the example:
Copyright © 2013 CA.
All rights reserved.
|
|