Page 1 of 1

logic implementation

Posted: Mon Mar 28, 2011 12:52 am
by kirankumarreddydesireddy
Hi Ray

Can you please let me know how to implement this logic in server job or in the source sql query

Input :

Account id Flag

123 Y
123 Y
124 Y
124 N
125 N
125 N


Output :

Account id Flag

123 Y
124 Y
125 N



In the source,

If there is flag as 'Y' for any of the one record with the same account id ,we should have target also as 'Y' only,

If there is 'Y' for one record and 'N' for another record with same Account id ,we should have 'Y in the target.

If the flag from the source for all the records as 'N',then only we should have target as 'N'

In target Account id is unique...


Thanks
Kiran

Posted: Mon Mar 28, 2011 2:06 am
by ray.wurlod
Why don't YOU try it first? We're not really here to solve your problems, we're here to help you with them.

And why did you choose to post a server question in the Enterprise Edition forum?

Posted: Mon Mar 28, 2011 2:22 am
by blewip
Simple to do in a transformer.

Sort the input on the key and the flag, so that the Y's are always before the N's for each key.

Then use a Stage Variable to check if it is a new Key, you would need to store the old Key value in another Stage Variable to do the check

If it is a new Key, check the flag; if it is a Y it will be a Y for all values of the Key and if it is a N it will also be a N for all values of that Key

Posted: Mon Mar 28, 2011 3:17 am
by kirankumarreddydesireddy
Thanks.I have tried this and it is working.





Thanks
Kiran

Posted: Mon Mar 28, 2011 11:18 am
by ray.wurlod
But have you learned anything (apart from begging for solutions)?