logic required

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
udayk_2007
Participant
Posts: 72
Joined: Wed Dec 12, 2007 2:29 am

logic required

Post by udayk_2007 »

Hello Friends

I have a requirement where if either of values are present then i need to put a particular value in other column.This can be done using a IF-ELSE statement but the problem here is a lot of values to be checked. For ex

If column A IN ('A','B','C'......15 values) then Column B='Value'

Any simpler way to implement this.

Thanks in advance

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

Post by ray.wurlod »

Search DSXchange for solutions using the Index() function.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
RAJARP
Participant
Posts: 147
Joined: Thu Dec 06, 2007 6:46 am
Location: Chennai

Post by RAJARP »

Ray,

This can be achived by using the mix of 'looping' capacicty of transformer and index() function.

Is this what you have intended/hinted?


Regards,
Raja R P
qt_ky
Premium Member
Premium Member
Posts: 2895
Joined: Wed Aug 03, 2011 6:16 am
Location: USA

Post by qt_ky »

No need for looping. Use Index() or a Lookup stage.
Choose a job you love, and you will never have to work a day in your life. - Confucius
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

As noted, you don't need a loop. A single Index() function can check all possible values. Delimit them, and the search string, with some character (space will do). For example, the following function will return 0 if not found and some non-zero value if found.

Code: Select all

Index(" A B C D E F G H I J K L M N O ", " " : InLink.ColumnA : " ", 1)
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
udayk_2007
Participant
Posts: 72
Joined: Wed Dec 12, 2007 2:29 am

Post by udayk_2007 »

Thanks All

I used Index() function and it worked

Regards
Ulhas
Post Reply