Professional Documents
Culture Documents
Business Purpose:
The Expression transformation is use to perform non-aggregate calculations for each data. Data can be
modified using logical and numeric operators or built-in functions. Sample transformations handled by
the expression transformer are:
Data Manipulation
Data cleansing - check nulls (ISNULL) , replace chars, test for spaces (REPLACESTR) , test for
number
Scientific calculations and numerical operations exponential, power, log, modulus (LOG,
POWER, SQRT)
Use transformation variables to break down complex transformation logic into smaller parts. You can
define variable port by clicking on V check box while defining the port. In the expression editor of it , it
can all input port and other variable port for calculation
It is highly recommended to define a naming convention for the input and output ports for expressions.
For example, all input ports have an in_ prefix for Input port , out_ for output ports and var_ for
variables port:
Ports are evaluated in the following order: input ports first, then variable ports in the display order
(from top to bottom), then output ports.
Solution:
Step 1:
Create a new Target table in the target table by the name of Employee_salary
Create Table TARGET.EMPLOYEES_SALARY (
EMPLOYEE_ID DECIMAL(6,0),
FULL_NAME VARCHAR(50),
JOB_ID VARCHAR(10),
SALARY DECIMAL(8,2),
COMMISSION_PCT DECIMAL(2,2),
TOTAL_SALARY DECIMAL(12,2));
Step 2:
Give a name Enter a name like exp_Salary, click on Create and then click on Done.
Drag all required port (EMPLOYEE_ID, FIRST_NAME, LAST_NAME, JOB_ID, SALARY,
COMMISSION_PCT) from Source Qualifier to expression transformation
Click on expression button for the FULL_NAME and add expression to concatenate
FIRST_NAME and LAST_NAME as FIRST_NAME|| ||LAST_NAME. You can use
Concatenate operator from Operator Keypad as show in below figure.
Click on Mapping ( from tool bar) -> then Validate ( to validate the mapping)
Now save the mapping ( by clicking on Repository-> Save or you can also press
Ctrl+S)
While your in the Informatica designers expression transformation, click on any function and
you can see the details of it in the information section as below:
You can get more information on any specific function by clicking on the Help button and then
typing the functions name in the search bar:
Syntax
IIF( condition, value1 [,value2] )
The following table describes the arguments for this command:
Argument
Required/ Description
Optional
condition
Required
The condition you want to evaluate. You can enter any valid
transformation expression that evaluates to TRUE or FALSE.
value1
Required
Any datatype except Binary. The value you want to return if the condition
is TRUE. The return value is always the datatype specified by this
argument. You can enter any valid transformation expression, including
another IIF expression.
value2
Optional
Any datatype except Binary. The value you want to return if the condition
is FALSE. You can enter any valid transformation expression, including
another IIF expression.
Unlike conditional functions in some systems, the FALSE (value2) condition in the IIF function is not
required. If you omit value2, the function returns the following when the condition is FALSE:
CONDITION
SALARY < 5000
SALARY >= 5000 && SALARY<10000
SALARY >= 10000
Solution
Step 1:
Create a new table in the TARGET database with the following definition:
Create one new output port in the expression transformation o_SALARY_STATUS and enter the
following expression in it: IIF(SALARY < 5000 , LOW , IIF(SALARY >= 5000 AND SALARY < 10000
, MEDIUM , HIGH))
Syntax
ERROR( string )
The following table describes the argument for this command:
Argument
string
Required/
Optional
Required
Description
String value. The message you want to display when the Integration
Service skips a row based on the expression containing the ERROR
function. The string can be any length.
Return Value
String.
FIRST_NAME VARCHAR(20),
LAST_NAME VARCHAR(25),
SALARY DECIMAL(8,2),
SALARY_STATUS VARCHAR(10));
Step 2:
Create another output port named o_SALARY_OUT and specify the following expression in it
IIF(SALARY<0 , ERROR(Negative Salary), SALARY):
Step 2:
Create another output port named o_SALARY_OUT and specify the following
expression in it IIF(SALARY<0 , ABORT(Negative Salary), SALARY):