Filename keywords in Jitterbit Integration Studio
Introduction
Filename keywords are used to generate unique filenames for configurable fields that take filenames as input. These include certain fields available when configuring endpoints using connectors. Filename keywords are one of the types of global data elements available in Harmony. The other types of global data elements — project variables, global variables, and Jitterbit variables — are also available globally throughout a project. They are set differently, as described in Project variables, Global variables, and Jitterbit variables, respectively. However, as all global data elements share the same namespace, their names must be unique when compared against all other global data elements.
Available keywords
The keywords listed in the table below are available to use in certain fields within endpoint configuration screens. The keywords are not case-sensitive. For example, [time]
is equivalent to [TIME]
and [Time]
.
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. The intended use of this keyword is in a file-type target filename field. |
[file] | Substituted with the base file name (that is, excluding the file extension, if any), as set when using a file-type source. The intended use of this keyword is in a file-type target filename field. |
[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. |
Tip
Note that the Jitterbit variable jitterbit.source.filename
gives the complete filename, is set with each source invocation, and can be used instead of the keywords [file]
and [ext]
.
Use filename keywords in configuration screens
During configuration of endpoints using connectors, you can use filename keyword substitutions in certain fields that have a variable icon . Filename keywords can be used in fields along with other input, including with other keywords or variables. These sections are covered below:
- Fields where keywords can be used
- Select a filename keyword
- Toggle formats between pill and text
- Remove a filename keyword
Warning
As keywords use the same syntax as global and project variables, it is possible to create a global or project variable that has the same name. Because this can cause confusion, we recommend not creating global or project variables that have the same name as these keywords.
The keywords override any variables of the same name when the project component is evaluated.
Fields where keywords can be used
Keyword substitutions are intended to be used within configurable fields that take filename(s) as input. This includes certain fields available during endpoint configuration of the connectors listed below.
Read activities
-
Optional Settings: After Processing > Rename File (File Share, FTP, Temporary Storage, and Local Storage Read activities)
-
Optional Settings: Trigger File > Absolute File Path (File Share, FTP, Temporary Storage, and Local Storage Read activities)
-
Optional Settings: Success/Error Folder > Success Folder in Absolute Path and Error Folder in Absolute Path (FTP and Local Storage Read activities)
Write activities
-
Filename(s) (File Share, FTP, Temporary Storage, and Local Storage Write activities)
-
Optional Settings: Compression > Filename(s) in Archive (File Share, FTP, Temporary Storage, and Local Storage Write activities)
-
Optional Settings: Success/Error Folder > Success Folder in Absolute Path and Error Folder in Absolute Path (FTP and Local Storage Write activities)
Note
A restriction on using filename keywords in Trigger File and Success/Error Folder is described later on this page under Limitations and workarounds.
Select a filename keyword
To access filename keywords, you can either click the variable icon or enter an open square bracket [
to display a list of keywords and variables.
Within the list, the keyword or variable type is indicated by the icon next to its name:
- for filename keyword
- for global variable
- for project variable
- for Jitterbit variable
In the list, hover over the keyword name to preview information about it:
The Value that appears in the information popup is always empty for a filename keyword. A default value for a filename keyword cannot be defined in a configuration field.
Select a keyword to add to the field at the location of your cursor, anywhere in the string. The variable is displayed in a pill format similar to that shown below:
To review information about the keyword, hover over the keyword pill:
Toggle formats between pill and text
To change the default keyword pill format to text format, click the collapse icon :
This toggles the display of the pill format to a text format, with the variable name enclosed within square brackets [ ]
:
To change from a text format back to pill format, change focus off of the field, such as by clicking into another configurable field. The field input automatically returns to the default pill format.
Remove a filename keyword
To remove a filename keyword, click the remove icon :
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, let's say you have a source file named customers.csv
and the current date is October 2, 2019.
You might try to use a keyword combination like this to set the target filename:
[file]_[date].csv
customers_2019-10-02.csv-_2019-10-02_02-02-54-525
However, because filename keywords are not resolved, instead the actual result is something like this, including the unresolved keywords still in brackets:
[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, called
filename_target
) as the target filename in the Success/Error Folder field.The global variable is resolved correctly for the success or error file, respectively.
Note
Similarly, with a source Trigger File, the use of filename keywords is not resolved correctly in a filename. As a workaround, use a global variable set to an appropriate value.