Task Name : How to calculate the non-aggregate functions by using Expression Transformation.
Expression Transformation : The Expression transformation is used to calculate values within a single row.
When you configure an Expression transformation, create an expression field for the output of each calculation that you want to use in the data flow. Create a variable field for calculations that you want to use within the transformation.
Mapping: Calculating the final value after applying a fixed discount of 25% on the given value.
Step 1 : Login to IICS, create a new mapping ,name it and save .Drag the source and import source Flat file SRC_CUSTOMERS and establish the source connections.
- The preview of the source data is
- Step 2 : Drag and drop the Expression Transformation and connect it to the source. Select it and go to properties.
- In General option Name the transformation eg:- exp_cust
- Check the incoming fields
- In Expression option click on + button to create variable or output fields.
-
- Create a variable field by selecting the below options and click on ok.
Field type= Variable Field
Name=V_discount
Type=int
- A variable field has been created. Now click on Configure .
- Configure the field by assigning formula to calculate the discount price.
Now create an Output field by selecting the below options and click on ok.
Field type= Output Field
Name=V_discount
Type=int
- Configure the field by assigning the formula and click on ok.
- Step 3: Connect the Target and go to properties.
- General : Name the target eg:Tgt_cust
- Incoming Fields : check all the incoming fields coming from expression.
- Target : Give Target connections (Serverhfgindia_orc_tgt_conn(Oracle)
- Object : Click on select option and select Create New at Runtime as Target Object and create table name (eg: Tgt_Cust_expression) and click on ok.
Step 4
: Save the mapping and create the Mapping Task. Once the mapping Task got created Run the mapping.
Step 5: Go to my jobs and check weather the data has been loaded successfully or not
- Output: The Target is a table hence we can see the data in