column swaping

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
pratik.470
Participant
Posts: 9
Joined: Mon Dec 31, 2007 2:50 am
Location: kolkata

column swaping

Post by pratik.470 »

Hi,

Source=table(t1) has col1,col2
Target=table(t2) has col3,col4

normal mapping (col1=>col3) and (col2=>col4)
on lookup[meeting some conditions] the column must be swapped ie.(col1=>col4) and (col2=>col3)

how to design....eny suggestion.

Thanks in adv,
Pratik.
fyaqq
Participant
Posts: 43
Joined: Thu Aug 31, 2006 5:05 pm

Re: column swaping

Post by fyaqq »

pratik.470 wrote:Hi,

Source=table(t1) has col1,col2
Target=table(t2) has col3,col4

normal mapping (col1=>col3) and (col2=>col4)
on lookup[meeting some conditions] the column must be swapped ie.(col1=>col4) and (col2=>col3)

how to design....eny suggestion.

Thanks in adv,
Pratik.
Can't you just put the logic in the derivation of the target.
For example, in col3's derivation ,put
if meet_condition Source.col2 else Source.col1
asitagrawal
Premium Member
Premium Member
Posts: 273
Joined: Wed Oct 18, 2006 12:20 pm
Location: Porto

Post by asitagrawal »

Hi,

One more way could be like this..

Create two output links from the transformer, one with normal mapping (col1=>col3) and (col2=>col4) and second link with on lookup[meeting some conditions] the column must be swapped ie.(col1=>col4) and (col2=>col3) Add the lookup[meeting some conditions] as the constraint of the transformer... later use Link collector.

HTH.
Share to Learn, and Learn to Share.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

That's unnecessary complication. The first answer is more appropriate, simply check the lookup status and swap values in each derivation based on the result of that check.
-craig

"You can never have too many knives" -- Logan Nine Fingers
asitagrawal
Premium Member
Premium Member
Posts: 273
Joined: Wed Oct 18, 2006 12:20 pm
Location: Porto

Post by asitagrawal »

I just presented an alternative.. :idea:
Share to Learn, and Learn to Share.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Of course. :!:
-craig

"You can never have too many knives" -- Logan Nine Fingers
pratik.470
Participant
Posts: 9
Joined: Mon Dec 31, 2007 2:50 am
Location: kolkata

Post by pratik.470 »

Hi,

Thanks..

:)
Pratik Mondal
asitagrawal
Premium Member
Premium Member
Posts: 273
Joined: Wed Oct 18, 2006 12:20 pm
Location: Porto

Post by asitagrawal »

Remember to mark the topic as resolved... :)
Share to Learn, and Learn to Share.
asitagrawal
Premium Member
Premium Member
Posts: 273
Joined: Wed Oct 18, 2006 12:20 pm
Location: Porto

Post by asitagrawal »

Remember to mark the topic as resolved... :)
Share to Learn, and Learn to Share.
Post Reply