String Expression Format Functions

Sample Manager Help

Reference

The following string formatters can be used when building URLs, or creating unique Sample IDs/names.

 NameSynonymInput TypeDescriptionExample
General
defaultValue(string) anyUse the string argument value as the replacement value if the token is not present or is the empty string.${field:defaultValue('missing')}
passThroughnoneanyDon't perform any formatting.${field:passThrough}
URL Encoding
encodeURIuristringURL encode all special characters except ',/?:@&=+$#' like JavaScript encodeURI()${field:encodeURI}
encodeURIComponenturicomponentstringURL uncode all special characters like JavaScript encodeURIComponent()${field:encodeURIComponent}
htmlEncodehtmlstringHTML encode${field:htmlEncode}
jsString stringEscape carrage return, linefeed, and <>"' characters and surround with a single quotes${field:jsString}
urlEncodepathstringURL encode each path part preserving path separator${field:urlEncode}
String
join(string) collectionCombine a collection of values together separated by the string argument${field:join('/'):encodeURI}
prefix(string) string, collectionPrepend a string argument if the value is non-null and non-empty${field:prefix('-')}
suffix(string) string, collectionAppend a string argument if the value is non-null and non-empty${field:suffix('-')}
trim stringRemove any leading or trailing whitespace${field:trim}
Date
date(string) dateFormat a date using a format string or one of the constants from Java's DateTimeFormatter. If no format value is provided, the default format is 'BASIC_ISO_DATE'${field:date}, ${field:date('yyyy-MM-dd')}
Number
format numberFormat a number using Java's DecimalFormat${field:number('0000')}
Array
first collectionTake the first value from a collection${field:first:defaulValue('X')}
rest collectionDrop the first item from a collection${field:rest:join('_')}
last collectionDrop all items from the collection except the last${field:last:suffix('!')}

Examples

FunctionApplied to...Result
${Column1:defaultValue('MissingValue')}nullMissingValue
${Array1:join('/')}[apple, orange, pear]apple/orange/pear
${Array1:first}[apple, orange, pear]apple
${Array1:first:defaultValue('X')}[(null), orange, pear] X

Discussion

Was this content helpful?

Log in or register an account to provide feedback


previousnext
 
expand all collapse all