Monday, 24 March 2014

How to find sum of negative and sum of positive integer separately?

For Example i Have source data like below.
Source 
Account_Balance
500
600
-300
-200
400
-100
Target
Total_Account_Balance
1500
-600
Step 1
Drag and drop one instance of source and two instance of target.
Step 2
Router
Create one Group
Negative_Number=SUBSTR(TO_CHAR(Account_Balance), 1, 1)='-'
Step 3
Aggregator
Create two Aggregator Transformation
Connect Aggregator1 from Negative_Number Group of Router Transformation
Create one port
Total_Balance (Output Port) = Sum(Account_Balance1)
Connect Aggregator2 from Default Group of Router Transformation
Create one port
Total_Balance (Output Port) = Sum(Account_Balance2)
Step 4:
Connect your both target instance from separate Aggregator Transformation.


Thanks
Ur's Hari
If you like this post, please share it by clicking on g+1 Button.

No comments:

Post a Comment