User Guide > Using the Any-Any Transformation Editor > Using the Transformation Editor > About Expressions
 
About Expressions
An expression is a combination of one or more values, operators, and functions that resolve to a value, like a formula. You can use expressions to return a specific set of data. The Transformation Editor can accommodate expressions in queries, loops, switches, and in the stand-alone Expression operation.
When writing expressions, use the inputs of the operation that contains the expression. For example if the operation has an EMP input column named, when you are defining the expression for that operation you can use the EMP input column as a symbol within the expression.
Because of the flexibility required by the Transformation Editor, the expression syntax that is supported is also flexible. Valid expressions can contain operators, names, paths, and literal values. The following table can be used to give you ideas for what you might want to use when defining your Expression.
Expression Components
Description
Operators
Expression operators are used to compute values, for example, with + or -. Operators contain one or two arguments. The supported operators are:
NOT, AND, OR, <=, >, <, <>, >=, =, +, *, -, /, and function calls
Names
Valid syntax for names is:
[ {namespaceURI} | prefix: ] name
Examples:
"customer", "{http://biz.com}customer", "biz:customer"
Paths
Paths can be used to refer to hierarchical elements of input parameters. Paths are names separated by slashes (/).
Literal Values
Literal values for use in expressions include:
boolean: true | false
integer:[0-9]+
nil: null
string: 'text'
decimal: [0-9]+.[0-9]*
hexadecimal: 0x[0-9a-f]*
datetime:yyyy-mm-dd [t-hh:mm]|z]
Function Calls
The Transformation Editor makes use of the following categories of functions:
Canonical—A function type that can be used regardless of the target language.
SQL—A function type that can be used only within SQL code.
Queries can be generated into SQL. Use the sql: prefix to specify a SQL function in an expression.
XQuery—A function type that can be used only within XQuery code.
Most operators are generated into XQuery. Use the xquery: prefix to specify a XQuery function in an expression.
Custom—A function type that is defined as custom within TDV.
Use the custom: prefix to specify a custom function in an expression.
The following canonical functions are available for use within expressions:
Aggregate: AVG, MIN, MAX, SUM, COUNT
Character: CONCAT, SUBSTRING, UPPER, LOWER, LENGTH, TRANSLATE, REPLACE, MATCHES, CHARACTER_LENGTH
Numeric: ABS, CEIL, FLOOR, ROUND
Date: CURRENT_DATE, CURRENT_TIME
Canonical functions are built in and cannot be created.
When creating a custom function, the Transformation Editor follows the same rules as for TDV SQL. You create a procedure with one output and promote it as a custom function within the TDV. Using it within a transform, requires the use of the "custom" prefix. For example, if you made a custom function called "amazing", then you'd invoke it within a transform expression using "custom:amazing(x,y,z)".
XQuery functions must be invoked with the "xquery" prefix. For example, to invoke the XQuery concat function, you would use "xquery:concat()". XPath expressions are not supported.
Transform expressions don't allow dashes within symbol names. Replace dashes (-) with underscores (_).