Typical Scenario - Schedule

Please help to set up following scenario

I have a source either file or db table

Eno ename sal dept
101 sri 100 1
102 seeta 200 2
103 lax 300 3
104 ravam 76 1
105 soorp 120 2

Want to run a session 3 times.

First time: it should populate dept 1
Second time: dept 2 only
Third time: dept 3 only

How can we do this?

Questions by n.sriramk   answers by n.sriramk

Showing Answers 1 - 7 of 7 Answers

Vijay132

  • Dec 2nd, 2010
 

Use the lookup transformation on target table and apply the look up condition.
otherwise use 
set variable function in an expression transformation or mapping variable.

  Was this answer useful?  Yes

sudhir24

  • Dec 31st, 2010
 

Use expression, filter and mapping variable.

Set initial value of mapping variable (eg.$$LOAD_DEPT) to 0.
In expression trans, add an output port V_LOAD_DEPT and assign to SETVARIABLE($$LOAD_DEPT,$$LOAD_DEPT+1)
Pass it to filter trans and add filter condition E_DEPT = V_LOAD_DEPT

The variable value is incremented by 1 each time session is run.
Eg. for the first run, the value will be 1, the filter condition matches Dept value 1 and only passes Dept 1 rows. For second run, it will be 2 and only Dept 2 rows will be loaded. (and similarly for future runs).

Write the following query in to the source qualifier,

select empno, ename, sal, deptno from emp_src
where deptno > (select max(deptno) from emp_trg);

the query returns only the department records from source, which are not yet loaded in to the target.

then you can use the rank(any other approach) transformation to get only the minimum department records. and then load to the target.

Cheers,

Nagaraju Puppala

vipuldass

  • Jul 11th, 2012
 

would go with sudhir24s answer.
@Nagaraju Puppala: The src query will not work when the mapping is executing for the first time, and there is no data in the tgt.

  Was this answer useful?  Yes

dileep671

  • Jul 25th, 2012
 

Put this query in Source Qualifier

select empno, ename, sal, deptno from emp_src
where deptno not in (select deptno from emp_trg);

Then connect it to Rank Transformation
In the properties, Select Top 1 Row...

From Rank.. connect to target Table.. 1 Row gets inserted every time when the session runs.

Cheers
Dileep

  Was this answer useful?  Yes

MAHESH MANAM

  • Sep 27th, 2012
 

We can solve this issue by the following types:

First, we can create a mapping parameter and run the mapping in each time give the parameter value according to your requirement.

Second, we can create a reusable expression and in that create a variable and assign value as 0 and increases by1.It pass to filter make condition on based on variable.If run in second time the value already stored in that variable and increase it by 1.

Third, we can create 3 different mappings and sessions in a single workflow and connect all these into start.Create workflow parameter and assign value based on requirement.

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions