How to do an 'IN' statement in a transformer.

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
Marley777
Premium Member
Premium Member
Posts: 316
Joined: Tue Jan 27, 2004 3:26 pm

How to do an 'IN' statement in a transformer.

Post by Marley777 »

Hi, need some help. Thanks for reading.

Trying to do something similar to an IN statement within a transformer stage. Have an input dataset that contains 4 years of data. Need to create two output datasets based on years given in two supplied job parameters. The job parameters have two different sets of years. Years in the job parameter will change from run to run, so I will never know what the years are, just know the input data will be 4 years of data and need to create two datasets.

For example:

Input data contains years 2008, 2009, 2010, 2011

One output dataset should contain 3 prior years (2008, 2009, 2010)
a second output dataset should contain 2 prior years plus current years (2009. 2010, 2011).

Was hoping I could use a constraint that works like and IN statement and the years in the constraint would come from job parameters. Input data and years in the job parameters would change from run to run.

greatly appreciate any ideas?
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

There is no IN available. You need something like

Code: Select all

svYear = #jpCurrentYear# Or svYear = #jpPreviousYear# Or svYear = #jpEarlierYear#
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
vinothkumar
Participant
Posts: 342
Joined: Tue Nov 04, 2008 10:38 am
Location: Chennai, India

Post by vinothkumar »

There is no explicit IN statement . But we can implement the same functionality through Index function.
Index('Year,Year-1, Year-2','Year',1) > 0
Marley777
Premium Member
Premium Member
Posts: 316
Joined: Tue Jan 27, 2004 3:26 pm

Post by Marley777 »

Thanks. Let me test these ideas and report back.
Post Reply