- 2 Minutes to read
- Print
- DarkLight
- PDF
System Variables
- 2 Minutes to read
- Print
- DarkLight
- PDF
System Variables
System Variables work in the same way as DEFINES but are automatically generated by the scripting engine at the time of execution.
They can be used in scripts to access selected system settings relating to paths, files, scripts and time-stamps.
System variables are replaced with their resolved values before a script executes.
System variables are READ-ONLY
Variable | Description | Resolves To |
%DSTAMP% | Script Execution Date Time Stamp | -YYYY-MM-DD-HH-MM-SS |
%DATAPATH% | Data Source: The root of the datasources folder | [installdirectory]/datasources/ |
%MYEXPORT% | My Export Folder: This user’s list folder | [installdirectory]/[realmdirectory]/output/username/ |
%OUTPUT% | Team Export Folder: System output Folder | [installdirectory]/[realmdirectory]/output/ |
%MYLISTS% | My List Folder: This user’s list folder | [installdirectory]/[realmdirectory]/Lists/username/ |
%LISTS% | Team List Folder: System lists folder | [installdirectory]/[realmdirectory]/Lists/ |
%TEMPLATES% | Templates: System template folder | [installdirectory]/[realmdirectory]/Templates/ |
%CONFIG% | This project’s config folder | [installdirectory]/[realmdirectory]/[ThisProject]/config/ |
%CURRENT_PROJECT% | Name of currently executing project | Only accessible from logging functions. |
%CALLING_PROJECT% | Name of project that called current project | May be blank if there is no calling project Only accessible from logging functions. |
%DSTAMP%
Date-time stamp of the format -YYYY-MM-DD-HH-MM-SS at the moment script execution begins.
Input | "filename": “Client%DSTAMP%.json" |
Resolves To | "filename": Client2022-12-11-15-32-17.json" |
%DATAPATH%
The root of the data source folder
The path of the DataJet datasources folder. Dependant on where DataJet is installed. Consistent across all projects.
Takes the form [installdirectory]/datasources/
e.g., F:/datajet/datasources/
Input | "filename": “%DATAPATH%Client.xlsx" |
Resolves To | "filename": “f:/datajet/datasources/Client.xlsx" |
%MYEXPORT%
This user's output folder
The path of DataJet active user’s output folder. Dependant on where DataJet is installed. Individual users use the same user output folder across all projects
Takes the form [installdirectory]/[realmdirectory]/output/username/
e.g., F:/datajet/dj-localhost/output/admin/
Input | "filename": “%MYEXPORT%Client.xlsx" |
Resolves To | "filename": “f:/datajet/dj-localhost/output/admin/Client.xlsx" |
%OUTPUT%
The system output folder
The path of the default DataJet output folder. Dependant on where DataJet is installed. Consistent across all projects.
Takes the form [installdirectory]/[realmdirectory]/output/
e.g., F:/datajet/dj-localhost/output/
Input | "filename": “%OUTPUT%Client.xlsx" |
Resolves To | "filename": “f:/datajet/dj-localhost/output/Client.xlsx" |
%LISTS%
The system lists folder.
The path of the default DataJet lists folder. Dependant on where DataJet is installed. Consistent across all projects.
Takes the form [installdirectory]/[realmdirectory]/Lists/
(NB: Lists are files containing lists of keys, and are used when importing files to create datasets).
e.g., F:/datajet/dj-localhost/Lists/
Input | "filename": “%LISTS%client1_keylist.xlsx" |
Resolves To | "filename": “f:/datajet/dj-localhost/Lists/client1_keylist.xlsx" |
%MYLISTS%
This user's lists folder
The path of the default DataJet lists folder for this user. Dependant on where DataJet is installed. Consistent across all projects.
Takes the form [installdirectory]/[realmdirectory]/Lists/username
e.g., F:/datajet/dj-localhost/Lists/admin
Input | "filename": “%MYLISTS%client1_keylist.xlsx" |
Resolves To | "filename": “f:/datajet/dj-localhost/Lists/admin/client1_keylist.xlsx" |
%TEMPLATES%
The system templates folder
The path of the default DataJet Templates folder for this user. Dependant on where DataJet is installed. Consistent across all projects.
Takes the form [installdirectory]/[realmdirectory]/Templates/
(NB: Templates refer to the excel template files used when exporting Dashboards to Excel, and are not to be confused with viewing templates, as accessed from the Explorer Solution Viewer).
e.g., F:/datajet/dj-localhost/Templates/
Input | "filename": “%TEMPLATES%dashboard1.xlsx" |
Resolves To | "filename": “f:/datajet/dj-localhost/Templates/dashboard1.xlsx" |
%CONFIG%
This project’s config folder.
The path of this project’s configuration folder. Dependant on where DataJet is installed. Each project has a config folder called config. Any custom files needed by only one project can be stored in the project’s config folder.
Takes the form [installdirectory]/[realmdirectory]/[projectname]/config/
e.g., F:/datajet/dj-localhost/testproject/config/
Input | "filename": “%CONFIG%config.txt" |
Resolves To | "filename": “f:/datajet/dj-localhost/THISPROJECT/config/config.txt" |
Working with system variables
It is possible to use more than one System Variable in a single JSON key/value pairing. It is also possible to use System Variables in combination with User Variables (DEFINES)
The following creates the user DEFINE %ROOT%, which contains the System Variable %DATAPATH%. This is then used with %DSTAMP% to generate a filename:
{
"METHOD": "DEFINES",
"VARIABLES": [
{
"KEY": "%ROOT%",
"VALUE": "%DATAPATH%TESTPROJECT/"
}
],
"PROJECT": "TESTPROJECT"
}
{
"METHOD": "EXPORTINTOWORKBOOK",
"FILENAME": "%ROOT%OUTPUT%DSTAMP%.XLSX",
"STARTROW": 1,
"SHEET": "SUMMARY",
"INCLUDEHEADERS": TRUE,
"ALL": TRUE,
"DATASET": {
"LOGIC": "OR",
"NAME": "ETL_TABLE",
"STRICT": TRUE,
"SET": [
{
"LOGIC": "OR",
"STYPE": "TABLE",
"ENTITY": " ETL_TABLE "
}
]
},
"PROJECT": "TESTPROJECT"
}
The resulting filename will resolve to f:/datajet/dj-localhost/output-2022-05-17-12-02-54.xslx
Viewing resolved values
It is not possible to view the resolved values of System Variables from within the Script Editor window. If the script variable window is displayed (CTRL L), then system variables will be displayed in their unresolved form.
This is by design.