Expression Language
Also available as:
PDF

ifElse

Description: Evaluates the first argument if the Subject evaluates to true, or the second argument if the Subject evaluates to false.

Subject Type: Boolean

Arguments:

  • EvaluateIfTrue : The value to return if the Subject is true

  • EvaluateIfFalse : The value to return if the Subject is false

Return Type: String

Examples: If the "filename" attribute has the value "a brand new filename.txt", the "nullFilename" attribute has the value null, and the "bool" attribute has the value "true", then the following expressions will provide the following results:

Table 1.1. Table 1. ifElse Examples

Expression

Value

${bool:ifElse('a','b')}

a

${literal(true):ifElse('a','b')}

a

${nullFilename:isNull():ifElse('file does not exist', 'located file')}

file does not exist

${nullFilename:ifElse('found', 'not_found')}

not_found

${filename:ifElse('found', 'not_found')}

not_found

${filename:isNull():not():ifElse('found', 'not_found')}

found