Expression examples

This topic provides additional examples on expression usage. In this topic, sample variable values are given to show how various expressions can use the information. The examples provided in this topic apply to:

  • Transfer site post-transmission actions
  • Subscription post-transmission actions
  • PGP
  • Account templates

For a complete listing of the Advanced Routing Expression Language (EL) functions and variables, refer to Custom Expression Language functions and variables.

Expression variables and examples

The following table provides the variable names and values that are used in the subsequent examples:

Variable name Value
DXAGENT_HOMEDIR /home/users/stuser
DXAGENT_TARGET document_12.txt
DXAGENT_TARGETPATH /home/users/stuser
DXAGENT_TRANSFORMATION_INPUT /home/users/stuser/PGP/encrypted.pgp
Note The variable DXAGENT_TRANSFORMATION_INPUT is only available from within a PGP transformation agent. Expressions using this variable do not evaluate correctly in other cases. In the example using this variable, assume that the original file name before encryption is original_12.txt.

The following table shows additional examples of the different expressions available for use in SecureTransport:

Example variable name Example return value
${env['DXAGENT_TARGET']} document_12.txt
${stenv['target']} document_12.txt
${stenv["target"]} document_12.txt
Prefix${stenv["target"]}.newext Prefixdocument_12.txt.newext
${stenv.targetpath} /home/users/stuser
${basename(} document_12
${extension(} txt
${filename('[0-9]','z').replace('[*&_]','-')} document-zz.txt
${basename(}-${random}.${extension(} document_12-C7F2119AAECEACCDE16C496C96FEEE39.txt
${stenv.loginname.replace('st', 'SecureTransport-')} SecureTransport-user
${'.*.txt') ? 1 : 0} 1
${'.*.pgp') ? 1 : 0} 0
${stenv.transformation_input.matches('\*.pgp') ? 1 : 0}
${embedded} original_12.txt
${basename(embedded)}-${timestamp}.${extension(embedded)} original_12-1345652729052.txt
${basename(embedded)}-${date('yyyy.MM.dd_hhmmss')}.${extension(embedded)} original_12-2012.08.22_162529.txt
${resolve(concat(stenv.homedir, '../..'))} /home
${empty var ? error('Missing Variable') : var} Either the value of $var or an exception

Related Links