logic implementation

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
kirankumarreddydesireddy
Participant
Posts: 110
Joined: Mon Jan 11, 2010 4:22 am

logic implementation

Post by kirankumarreddydesireddy »

Hi

I have requirement as below.


Source

Cash_receipt_id Amount

200 500

201 500



Lookup

Status Amount Cash_receipt_id Cash_history_receipt_id


Cleared 500 200 1000

Reversed 500 200 1001

Cleared 500 201 1002



Target (only one cash_receipt_id )



Cash_receipt_id Net receipt Amount


200 0

201 500


Can any one please let me know the logic.



Thanks
Kiran
nayanpatra
Participant
Posts: 41
Joined: Sat Jun 06, 2009 11:13 pm
Location: Kolkata

Post by nayanpatra »

Read the input records into a transformer stage.

Now give 2 output columns:

Cash_receipt_id: Populate the input Cash_receipt_id
Amount: If Status = Cleared Then Amount Else (-1) * Amount

Now add the Amount field group by Cash_receipt_id in aggregator stage and you will get the desired output.

Note: Remember to sort on Cash_receipt_id in aggregator stage.
Nayan
kirankumarreddydesireddy
Participant
Posts: 110
Joined: Mon Jan 11, 2010 4:22 am

Post by kirankumarreddydesireddy »

Thanks nayan




Thanks
Kiran
Post Reply