Process Total Number of Records in Two Parts and Load It Based Upon Session Run

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

Process total Number of Records in two parts and load it based upon session run.

Create a mapping as shown below.


Step1: Drag and drop two sources (must be same)

Step2: Create Aggregator Transformation (Create two output ports Count_emp count(emp_id) and
Dummy 1)

Step3: Create Expression transformation for second flow and create an output port Dummy1  1

Step4: Create Joiner transformation (use normal join and condition Dummy = Dummy1)
Drag and drop all the columns from joiner to expression.

Step5: Create another expression transformation

In the expression apply logic as shown below.

Naga
REC_CNT  OLD_REC_CNT+1
OLD_REC_CNT  REC_CNT
REC_ID  REC_CNT
HALF_REC  ROUND (COUNT_EMP/2)

Now create a mapping variable (mappings tab  Parameters and variables) as integer and initial value 1

Naga
Now Create Router transformation, create two groups and apply the logic

FIRST_HALF: IIF($$MAP_CNT=1 AND REC_ID<=HALF_REC,TRUE,FALSE)


SECOND_HALF: IIF($$MAP_CNT=2 AND REC_ID>HALF_REC,TRUE,FALSE)

Connect to one target by taking two instances (I have taken two different targets)

Go to workflow manager

Create a session (non-reusable) in workflow manager

Naga
Create a workflow variable ($$SESSION_RUN) and initial value 1 by editing the workflow

Naga
Goto  session properties  component tab

Edit presession_variable_assignment and assign mapping variable to workflow variable

Now create assignment task

Add below user defined variables in assignment task

IIF($$SESSION_RUN=1,$$SESSION_RUN+1,$$SESSION_RUN-1)

Naga
Link the task from session to assignment.

Execute the workflow and verify the results.

Naga

You might also like