Show TOC

Procedure documentationDefining Dynamic Expressions Locate this document in the navigation structure

 

You use the Dynamic Expression Editor dialog box to define specific behavior in a property of a model element. A dynamic expression is a formula that you define for generating a dynamic field value. The Dynamic Expression Editor dialog box enables you to define dynamic expressions and then validate their syntax. For more information, see Dynamic Expression Editor Dialog Box.

For examples of how to use functions in dynamic expressions, see Tables of Functions.

Procedure

  1. Click the Function (fx) icon displayed to the right of the attribute or property field into which you want to enter a dynamic expression. The Dynamic Expression Editor dialog box is displayed.

  2. In the Function pane on the right of the dialog box, expand the node for the category that contains the function that you want to use. Each function has an explanatory tooltip.

    Make sure that the icon of the function that you choose matches the required data type. You can see the text displayed above the Expression pane to check what data type is expected in the result: Edit a dynamic expression that returns a result of data type: <Data_Type>.

  3. Drag the required function to the Expression pane on the left of the dialog box.

    For example, you may want to expand the Conditional Functions node and use the IF function. In this case, the following expression is displayed in the Expression pane:

    IF(test,expr1,expr2)

    where test is any value or expression that can be evaluated to TRUE or FALSE, expr1 is the value that is returned if test is TRUE, and expr2 is the value that is returned if test is FALSE.

  4. Use the displayed formula to create your custom expression. You can write the expression by entering free text in the Expression pane, by dragging additional functions from the Function pane to the Expression pane, or by using a combination of the two methods.

    You can use the Data Fields node to locate another field whose value you want to include in your expression. To do this, expand the node and drag the field to the required position in the expression.

    Note Note

    You cannot use a complex field directly in a dynamic expression; you can use only the fields contained within the complex field (@ComplexField.Field).

    End of the note.

    For more information about the required syntax, see Tables of Functions or click the Show help on this function link in the Dynamic Expression Editor dialog box.

  5. Click anywhere in the Description field to open the Description dialog box. Enter any text related to the dynamic expression, such as a reminder or note to other users, and click OK.

  6. Click Check to ensure that the dynamic expression is valid. If an error occurs, an explanatory message is displayed. For more information about possible messages, see Messages in the Dynamic Expression Editor Dialog Box.

  7. When your expression is valid, click OK. The expression is displayed in the property or attribute field from which you accessed the Dynamic Expression Editor dialog box.