Global Variables

Top  Previous  Next

Overview

 

In addition to system scripting variables, InFocus supports custom variables for use in advanced query applets like SQL Query, Custom Reports and Dashboard Queries Manager.

 

Created in Global Settings, these variables are assigned a value is inserted into the query at execution.

 

Global Variables are referenced in queries using the following syntax: @variable@.

 


 

Tutorial

 

In the following example, we’ll variablize a specific project’s internal ProjectID by creating the variable and utilizing it in the SQL Query applet.

 

Creating the Variable

 

1. Browse to AD>Global Settings

2. Select the Global Variables tab

3. Enter the Variable Name: project. The Variable calculated column will automatically build the variable @project@, which is the syntax for using the variable later.

4. Enter a Value of 5

5. Click Save

 

Using the Variable in SQL Query

 

1. Browse to UT>SQL Query

2. Enter the following: select projectid, projectpath from projects where projectid=@project@

3. Check Replace Variables Before Execution to enable the use of the variable

4. Click Run Query from the toolbar