Chart Variables
Of course! Here's the documentation about Variables for your Infinity platform, formatted for GitBook:
Variables
Variables in Infinity act as dynamic parameters that can be passed to SQL queries at runtime. They allow for top-level filtering on Vectors and Storyboards, ensuring that users can filter data even before it is pulled for chart creation.
A Variable is a {name, value}
tuple:
Name: Display name shown to the user.
Value: Underlying value used in SQL queries.
After creating a variable, you can reference it in a database query using a $
symbol prefix, for example, $country
.
Example Usage in SQL
Purpose of Variables
Enable dynamic filtering of data in Vectors and Storyboards.
Help in building queries where the value can change based on user selection.
Improve the flexibility and reusability of dashboards and reports.
How to Create a Variable
Navigate to Settings → Site Settings → Variables.
Click on Add Variable.
Fill out the form:
Name:
Unique identifier for the variable.
Must start with a lowercase letter.
Only underscores (
_
) are allowed as special characters.
Label:
The display name visible to the users.
Type:
The data type of the variable (String, Integer, or Date).
Database:
The source database from which the
{name, value}
tuples are fetched.
Order By:
Query: Display order as returned by the query.
Most Viewed: Display based on usage/viewership.
Query:
SQL query that fetches
{name, value}
pairs.Must be a
SELECT
query returning onlyname
andvalue
columns.
Example Variable Query
Linked Variables
Linked Variables allow you to create dependent relationships between multiple variables. For example: Country → State → County.
In a Linked Variable:
Each variable remains a
{name, value}
pair.Variables are comma-separated when created, e.g.,
country,state,county
.At query time, each variable can be referenced as
$country
,$state
, and$county
.
Example Linked Variable Query
User Access Restrictions on Variable Values
Infinity allows restricting variable values based on User, Role, or Distribution List (DL) access.
User/Role/DL columns must be included in the variable query.
If the User/Role/DL column is
NULL
, the variable value is accessible to everyone.Otherwise, it must contain a comma-separated list of IDs permitted to access that value.
If the list is large, you are encouraged to create Distribution Lists (DLs) for easier management.
Example Access Control Query
Behavior:
"West" is accessible only to User ID 2.
"Central" is accessible to User IDs 20 and 71.
"Great Lakes" is accessible to everyone (because User is
NULL
).
Key Points to Remember
Variable names must be unique and lowercase.
Variables provide dynamic SQL filtering.
Linked Variables allow cascading, hierarchical relationships.
User access can be controlled at the variable value level.
Last updated