Create Variables to Use in Expressions
In Data Modeler, you can define variables that dynamically calculate and store values so that you can use those values in column expressions or data filters.
Topics:
About Variables
Variables dynamically calculate and store values so that you can use those values in expressions. You can use variables in column expressions, or in data filters.
For example, suppose User1 belongs to Department1 and User2 belongs to Department2. Each user must access only the data that is specific to his department. You can use the DEPARTMENT_NUMBER variable to store the appropriate values for User1 and User2. You can use this variable in a data filter in which the data is filtered by Department2 for User1 and Department2 for User2. In other words, variables dynamically modify metadata content to adjust to a changing data environment.
Values in variables aren’t secure, because object permissions don’t apply to variables. Anybody who knows or can guess the name of the variable can use it in an expression. Because of this, don’t put sensitive data like passwords in variables.
You can’t use a variable in an expression that defines another variable.
Define Variables
You can create a variable for use in column expressions and data filters. For example, a variable called SalesRegion might use a SQL query to retrieve the name of the sales region of the user.
Tip:
Only reference source database objects in the SQL query for a variable. Don’t include names of semantic model objects in the query.
After you have defined a variable, you can use it in a data filter or in a column expression.