Global Variables
Global Variables let you define reusable values—either hardcoded or calculated dynamically—for use across SEI. These variables can be referenced throughout the platform (for example, in filters, column headings, selection pages, calculations, or translations).
You can use global variables in the SQL Script Builder in the Data Model Designer for calculations, or as column headings in translations.
When to use global variables
- Standardizing dynamic values: Store values, such as the company name, current fiscal period, or default currency, that should be reused across multiple reports or dashboards.
- Centralizing custom logic: Manage complex or frequently updated calculations in a single place, so updates are reflected everywhere the variable is used.
- Automating context-sensitive content: Use scripts to generate context-specific text, labels, or data that update automatically as business logic or environment changes.
Create a global variable
- From the navigation panel, click the gear icon at the bottom. The Administration page opens.
- Select Global Variables from the menu.
- Click Add New Record.
- Enter the required fields.
- (Optional) If you choose Javascript as the type, click Evaluate Expression to preview the result of your script.
- Click Create.
Global variables properties
| Field | Description |
|---|---|
| Key | Enter a unique identifier. Keys must start with @@ and are typically uppercase (@@DATE, @@USER). |
| Description | Enter a description to help identify the purpose of the variable. |
| Type of the global variable | Choose between:
|
| Data Type | Select the expected data type for the variable. |
| Data Source | (If type is JavaScript) Select the source of data used in the script. |
| Script | (If type is JavaScript) Enter the JavaScript code manually, or click JavaScript Builder to build or insert a script. |
| Result | (If type is JavaScript) Click Evaluate Expression.
|
JavaScript builder
The JavaScript Builder helps you write, validate, and test scripts for dynamic global variables. Use this tool to build logic using functions, operators, constants, and global variables, so you can calculate values based on your data source or advanced logic.
| Field | Description |
|---|---|
| Script Editor | Write or paste your JavaScript code directly in the editor area at the top. |
| Code helpers | Use operator and function buttons above the editor to quickly insert operators, brackets, or keywords. |
| Scripts Keywords | Find and insert built-in JavaScript functions, statements, operators, and constants using the left-side menu. |
| SEI | Access and insert SEI-specific global variables, special functions, and special variables. |
| Search | Type keywords to quickly locate available functions, variables, or operators to use in your script. |
| Validate | Click to check your script for syntax errors before confirming. |
Use the JavaScript builder
- Click JavaScript Builder in the global variable window.
- Write or paste your JavaScript code in the editor.
- Use the panels on the left to search for and insert available functions, statements, operators, or variables.
- Use the code helper buttons to insert common operators and structure your script.
- Click Validate to check for syntax errors. If syntax is valid, a green message appears below the editor.
- Click Confirm to insert your script into the global variable.
tip
Use necResult = as the return value for your script.