informaticainformatica-powercenter

How to perform loop in informatica power center?


how to create a mapping with loop in informatica powercenter. It should read a count with where clause from a table and for that I will use a expression then delete if matches if the count is >0 and also commit in intervals.


Solution

  • You dont need a loop. You can use Joiner/filter/aggregator and target definition with correct Key defined.

    1. Sort the data as per the key column.
    2. use filter transformation to apply where condition.
    3. Then use Aggregator transformation to get a count. You can also apply above where condition in COUNT() to avoid a filter transformation.
    4. join above aggregator and main flow on a dummy column.
    5. Use a Router transformation like this -
    group 1 = rcount >0
    group 2 = rcount <=0
    
    1. connect your target to group 1. Then in target link key columns. In infa session properties, set only delete for target. Also ensure taregt commit interval is 1000.

    Pls note if you dont want to use key column as delete and want to use some other column, you can use target overwrite SQL as well.

    Whole mapping will look like this

          |-FIL--> Agg_Cnt-->|
    SQ --> ----------------->JNR_mainflow -->RTR_cnt_gt_0 -->Target