Filename keywords in Jitterbit Design Studio
Introduction
Filename keywords are used to generate unique filenames for configurable fields that take filenames as input. Fields specifying filenames are available when configuring file-based sources and targets.
Available keywords
These keywords are available to use within configurable fields for filenames that allow the use of a variable. As shown below under Input filename keywords, you can test their availability by entering a single left square bracket ([
); if a drop-down list of keywords and variables appear, the keywords will appear at the top and can be used. Keyword substitutions are not case-sensitive: [TIME]
and [Time]
are equivalent to [time]
.
This list shows the available keywords and what they are substituted for:
Keyword | Substitution |
---|---|
[date] | Substituted with the current date in the format YYYY-Mon-DD . |
[ext] | Substituted with the file extension, if any, as set when using a file-type source. See Warning below this table. |
[file] | Substituted with the base file name (that is, excluding the file extension, if any), as set when using a file-type source. See Warning below table. |
[sequence] | Substituted with the sequence of the file: 1 for the first, 2 for the second, and so on. Similar to the Jitterbit functions SourceInstanceCount() and TargetInstanceCount() . |
[time] | Substituted with the current time in the format HHMMSS . |
[unique] | Substituted with a GUID, a random unique identifier. |
Warning
As keywords use the same syntax as global and project variables, once you use a keyword and save the project item, it will appear in the list of global variables for your project and as a duplicate entry in the drop-down list. It's also possible to directly create a global or project variable that has the same name and end up with additional entries in the dropdown list. As this can cause confusion, we recommend not creating global or project variables that have the same name as these keywords. The keywords will override any variables of the same name when the project item is evaluated.
Note that [file]
and [ext]
are set in the source, and are available as the variables $file
and $ext
respectively. However, the intended use is in the filenames of a target, and they should not be read directly from the global variables. The Jitterbit variable $jitterbit.source.filename
gives the complete filename, is set with each source invocation, and can be used instead.
Use filename keywords in definition screens
During configuration of sources and targets, you can use filename keyword substitutions in certain fields that have text entry. Keyword substitutions are intended to be used within configurable fields that take filename(s) as input. Though you can use any of these keywords in either sources or targets, they only work in certain uses and contexts. In these locations, you can use filename keywords:
Sources
-
For File Share, FTP Site, Temporary Storage, and Local File sources:
- Trigger File (Absolute file path)
- After Processing (Rename File)
-
For FTP Site, Temporary Storage, and Local File sources:
- Success/Error Folder (Success/Error folder in absolute path)
Targets
-
For File Share, FTP Site, and Temporary Storage targets:
- Filename(s)
- Compression (Filename(s) in archive)
-
For FTP Site and Local File targets:
- Success/Error Folder (Success/Error folder in absolute path)
See the below section Limitations for the current restrictions on the implementation of filename keywords.
Input filename keywords
To use a keyword along with other field input, including other keywords or variables, enter an open square bracket ([
) into the field. From the list, hover over the keyword name to preview information about it. Select a keyword to insert it at the location of your cursor, anywhere in the string:
Variables entered via this method are displayed as text within square brackets [ ]
within the field. Enter any additional input or add multiple keywords and variables using the same method described above:
Filename keyword how-tos
See these sections for details on using filename keywords in your projects:
Limitations and workarounds
When using filename keywords in the Trigger File or Success/Error Folder fields, a limitation is that the keywords are not resolved when using the trigger file or creating the success or error file, respectively.
For example, if you have a source file named customers.csv
and the current date is October 2, 2019, you might try to use a keyword combination such as this to set the target filename:
[file]_[date].csv
With this example, if the filename keywords were resolved, you would expect the result to be a success file named, with the trailing underscore and timestamp being added by the Success/Error Folder functionality, such as:
customers_2019-10-02.csv-_2019-10-02_02-02-54-525
However, because filename keywords are not resolved, the actual result will be, including the unresolved keywords still in brackets, such as:
[file]_[date].csv_2019-10-02_02-02-54-525
A workaround is to use a global variable instead of filename keywords for the target filename:
-
Create a global variable in a condition added to a target node of the transformation, and set that global variable to specify the source filename.
In this example, a filename has been created that uses the source filename and the current time, in UTC:
<trans> If(SourceInstanceCount() == 1, $filename_target = $jitterbit.source.filename + "_"; $filename_target += Replace(GetUTCFormattedDateTime(Now(), "UTC", false), ":", "-"); ); true; </trans>
-
Use the global variable (in the example,
filename_target
) as the target filename in the Success/Error Folder field:[filename_target].csv
The global variable will be resolved correctly for the success or error file, respectively as required.
Note
Similarly, with a source Trigger File, the use of filename keywords will not be resolved correctly in a filename. As a workaround, use a global variable set to an appropriate value.
Filename keyword examples
-
A target that uses the
[date]
and[time]
keyword variables to create a unique filename each time the target is used: -
This example shows adding to the
[date]
and[time]
keyword variables of the previous example the file[file]
and extension[ext]
from the source in the created filename: