Map rules as expressions
A map rule is an expression that evaluates to data. An expression is any valid combination of literals, data object names, operators, functions and map names. The expression in a map rule generates the desired data. For example:
- The expression Name Field:Input evaluates to the value of the data object Name, which is a subtype of Field, which is a component of the data object Input.
- The expression 500 evaluates to a data object with a value of 500.
- The expression COUNT (Record:OrderFile) evaluates to a data object that has a
numeric value equal to the count of the Record objects in the data object OrderFile.
A map rule has a maximum length of 32K characters. Rules in older maps might start with an equals (=) sign.
Some examples of simple expressions are shown in the following table.
- Expression
- This expression uses:
- "ABC Company"
- a literal
- City Field:Record
- a data object name
- City Field:Record + State Field:Record + ZipCode Field:Record
- operators (plus signs) and data object names
- UPPERCASE (City Field:Record)
- the UPPERCASE function and a data object name
- RecordMap (Record:InputFile)
- a map name (RecordMap) and data object names
An expression can be complex and have simpler expressions nested within it. Examples of more complex expressions using nested expressions are shown below:
IF (Qualifier = "ST", Address, NONE)
LOOKUP (ProductCode:LookupList, ItemCode:Data =
ItemCode:LookupList)
EXTRACT (Record:Input, Company Field:Record:Input = "My
Company")
COUNT (EXTRACT (Row:Input, Company Column:Row:Input = "My
Company"))
These examples use the functions IF, LOOKUP, COUNT, and EXTRACT. These functions are specific to the IBM Transformation Extender suite of products. Functions have their own syntax. For more information on functions, see the Functions and Expressions documentation.