How to access the arguments and other values from the script body?
To access an argument from the script body, you should refer to the corresponding parameter name.
Accessing arguments from script body
A script body can access the following values:
- Arguments passed to this script as parameters, such as the Context parameter in the preceding figure.
Values passed to the structured expression, inside of which the script operation is defined.
Arguments passed to a nested operation as parameters, if the script operation is defined inside of that nested operation.
Accessing argument passed to parameter of nested operation
Globally defined values:
How many statements can a script have?
The script can have multiple statements. In this case the result of the entire script is the result of the last statement.
What MagicDraw functionality can a script use?
The script can call MagicDraw Open API.
Using UML metamodel Open API to navigate between UML elements
More complex model access operations are available in ModelHelper and StereotypesHelper.
Using ModelHelper to define filtering condition script
How to simplify scripts?
To simplify the script, move complex sub calculations out of the script. Use other operations of the structured expression to specify these sub calculations and then pass the results to the script through parameters.
Using Find operation to simplify script body