logic implementation

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, 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 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
Last edited by kirankumarreddydesireddy on Mon Mar 28, 2011 2:15 am, edited 1 time in total.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post 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?
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
blewip
Participant
Posts: 81
Joined: Wed Nov 10, 2004 10:55 am
Location: London

Post 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
Modern Life is Rubbish - Blur
kirankumarreddydesireddy
Participant
Posts: 110
Joined: Mon Jan 11, 2010 4:22 am

Post by kirankumarreddydesireddy »

Thanks.I have tried this and it is working.





Thanks
Kiran
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

But have you learned anything (apart from begging for solutions)?
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply