User Variables

 

User variables are a way of saving values and expressions for later use. This saves you having to enter them anew each time if they are frequently needed in precisely this form or if user-defined data is to be output repeatedly. They are, so to speak, "formula building blocks".

You can then store these user variables in project includes if they are also to be used in other projects.

 

Note: User variables cannot be used within appearance conditions for layers.

 

You can also use the SetVar() and GetVar() functions if you only want to save values in the variable repository for later use. You will find more information about functions in the chapter Overview of Functions.

 

Proceed as follows to define user variables:

1.  Choose Project > User Variables or the "Edit user variables" button in the formula wizard.

2.  In the dialog that follows, create a new user variable via the "Insert a new variable" button.

3.  An entry dialog appears where you can enter a description of the new variable. Give the variable a meaningful name, the "@" character will be added automatically as a prefix.

4.  Click the "Edit" button to open the formula wizard and assign a field or an expression to the new user variable.

image168_229

Figure 7.24: Edit user variables

5.  You can use the arrow to specify the evaluation order. The variables are evaluated from top to bottom.

6.  Once you have defined the user variables, you can use them in your objects. In the formula wizard, you will find the user variables at the end of the variable list in the "User variables" folder. In the tool window "Variables-/Field-List" the user variables can be directly edited by double clicking and via a context menu.