LabKey Server supports a number of substitutions that can be used with transformation scripts. These substitutions work both on the command-line being used to invoke the script (configured in the
Views and Scripting section of the
Admin Console), and in the text of transformation scripts themselves. See
Transform Scripts for a description of how to use this syntax.
| Script Syntax | Description | Substitution Value |
|---|
| ${runInfo} | File containing metadata about the run | Full path to the file on the local file system |
| ${srcDirectory} | Directory in which the script file is located | Full path to parent directory of the script |
| ${apikey} | A session-scoped API key | The string value of the Session API key, used for authentication when calling back to the server for additional information |
| ${baseServerURL} | The server's base URL and context path | The string of the base URL and context path. (ex. "http://localhost:8080/labkey") |
| ${containerPath} | The current container path | The string of the current container path. (ex. "/ProjectA/SubfolderB") |
| ${transformOperation} | The operation that triggered the script | "INSERT" when a run is imported or re-imported. "UPDATE" when result data is edited. |
Unreplaced Substitution Tokens
Before a transformation script runs, the server replaces each substitution token in the script text. If any text in the form ${name} remains after substitution, the import fails with an error like:
Unreplaced substitution parameter(s) found in script: name
This check covers the entire script, including comments and string literals. If your script needs a literal "${...}" string for another purpose, such as a shell variable, build the string at runtime instead, for example by concatenating "$" and "{name}".
Related Topics