Predefined functions

SecureTransport supports the following predefined functions:

Name Syntax Description
Date${date()}
or
${date(date-and-time-pattern)}
Returns the current date and time. The date-and-time pattern is the same format defined in the Java class java.text.SimpleDateFormat. If no format is specified then the output is the default date format in the current locale.
dayOffset ${dayOffset('yymmdd', 'var1')} Returns the current date and time with var1 days added or subtracted as an offset.
Random ID${random()} Creates a pseudo-random string using both letters and numbers. Format is a 32 byte hex string.
String Concatenation${concat(var1, var2)} Creates a new string concatenating the two variables together.
Substring ${substring(variable, beginIndex,endIndex)}

Returns a substring for a given string.

The substring begins at the specified beginIndex and extends to the character at index endIndex - 1. Thus, the length of the substring is endIndex-beginIndex.

Force Exception${error()} or ${error(message)} Throws an exception error. If ${error(message)} is used, a message is returned with the error. This message is logged along with the exception.
File Name${filename(variable)} Returns the target file name with the extension, but without the path to the file.
File Basename${basename(variable)} Returns the target file name without the extension or path to the file.
File Extension${extension(variable)} Returns the target file extension, including the dot. If there is no extension, an empty string is returned.
${resolve()} Removes any occurrence of ., or . in a file path. This function works with POSIX style paths only. If the resolved path is null, empty or returns a /, an error is returned.

Predefined function examples

The following table shows examples of the predefined functions:

Name Example usage Example return value
Date (default) ${date()} June 22, 2012 1:42:04 AM
Date (formatted) ${date('EEEE, M-d H:m’)} Friday, 6-22 1:42
DayOffset ${dayOffset('yymmdd', '-1')} ${dayOffset('yyMMdd', '-5')} - returns 10th if today is 15th of August formatted as per the specified format parameter - 120810.

${dayOffset('yyMMdd', '+7')} - returns 22th if today is 15th of August formatted as per the specified format parameter - 120822.

${dayOffset('ddMMyy', '+1') ge '090414'}

Random ID ${random()} C7F2119AAECEACCDE16C496C96
FEEE39
String Concatenation ${concat('str', 'ing')} string
Substring

/${substring(stenv.loginname,0,1)}

where

stenv.loginname is interoperable with env['DXAGENT_LOGINNAME']

string
Force Exception ${error()} com.tumbleweed.util.
expressions.
InvalidExpressionException

Caused by: java.lang.Exception: Unspecified error
Force Exception
(with a specific error message)
${error(message)} com.tumbleweed.util.
expressions.
InvalidExpressionException Caused by: java.lang.Exception: An error has occurred in this part of the process!
Full File Name ${filename($file)} filename.txt
File Basename ${basename($file)} filename
File Extension ${extension($file)} .txt
Path Resolution ${resolve('.././path')} path
Path Resolution with Error ${resolve('../../..')} com.tumbleweed.util.
expressions.

InvalidExpansionException: Invalid path resolution: /
Path Resolution with Error ${resolve('\\')} com.tumbleweed.util.
expressions.

InvalidExpansionException: Path must not contain '\' character

Related Links