You are on page 1of 6

Assignment – 15

Before going through this Assignment please read Workflow variable and
Assignment Task and understand how they are working.

Source Data (Flat file or DB table)

EMP_ID ENAME DEPT_ID SALARY


101 Max 1 40000
102 Steve 2 30000
103 Alex 3 50000
104 Tim 1 20000
105 Tony 2 35000

Output should be like as below.

First run:

EMP_ID ENAME DEPT_ID SALARY


101 Max 1 40000
104 Tim 1 20000

Second Run:

EMP_ID ENAME DEPT_ID SALARY


101 Max 1 40000
104 Tim 1 20000
102 Steve 2 30000
105 Tony 2 35000

Third Run:

EMP_ID ENAME DEPT_ID SALARY


101 Max 1 40000
104 Tim 1 20000
102 Steve 2 30000
105 Tony 2 35000
103 Alex 3 50000
Mapping as shown below.

Before adding transformations create a mapping variable with initial value 1

In Sorter Transformation Sort data for Dept id only.

Page 2 of 6
Expression is not having any logic (Just only given for flow)

In Filter Transformation use DEPTID = $$DEPT_NO

Connect required ports to Target

Now go to workflow manger tool

Create Workflow and non-reusable session as shown below.

Note: Do not check Target truncate option if your target is DB table. Choose
append if exists option if your target is Flat file

Page 3 of 6
Now, Edit workflow to create a workflow variable as shown below.

Click on variables tab then create a variable $$DEPT_ID with Default value is 1

As shown below.

Page 4 of 6
Now create assignment task by using tasks tab in workflow designer.

Link Assignment task as below.

Now, edit session properties goto components tab

Click here

Add pre-session variable as shown below.

Page 5 of 6
Now, Edit assignment task (goto expressions tab) to assign user defined variables.

This is useful to increment $$DEPT_ID value after workflow run and same will be
storing in workflow pre-session assignment.

Trigger workflow you can see the desired results.

Page 6 of 6

You might also like