Variable Registration (Assignment)
To designate a specified variable value as a query condition for data, you need to delcare the variable.
There are two ways to use variables; declaring variables through a script or using the Variable Editor menu.
SQL Binding Rules
Since SQL Binding rules differ depending on the variable type, you must specify the variable name with a reserved keyword that matches the type.
- String Variable Reserved Keyword (:VS_)
Variables starting with 'VS_' are executed with '' (Single Quotation Marks) added before and after them during SQL binding.
Ex) AND USER_NAME = :VS_USER_NAME → AND USER_NAME = 'Tom' - Numeric Variable Reserved Keyword (:VN_)
Variables starting with 'VN_' are simply substituted with their values during SQL binding.
Ex) AND AGE = :VN_AGE → AND AGE = 28 - Line Deletion Option (@)
If you prefix a variable reserved keyword with the '@' symbol, its query condition line will be deleted when the variable has no assigned value.
Ex) WHERE 1=1 AND USER_NAME = @:VS_USER_NAME → WHERE 1=1
Utilizing Controls
You can assign the variable name to the Name field of a Control.
Utilizing the Variables Editor
You can register variables and assign their values using the Variables Editor.
How to Use the Variables Editor Window
- Add/Delete : Add or delete variables.
- Specify Variable
- Assign the Variable Name starting with VS_ or VN_.
- Assign the Value.
- Enter the Value directly
- Create a Formula to return a result value
- Set the Value by utilizing source code within the report
Using Variables
Used in DataSource
Used in SQL Statements
Used in i-META Viewer
Used in Client Script
Parameter-related APIs
- Loading a Control
Matrix.getObject(name) - Loading a variable from the Variables Editor
Matrix.GetVariable(name) - Assign a variable value in the Variables Editor
Matrix.SetVariable(name, value)
Check Variable Binding Result
You can check the variable binding results through the Log Viewer.