Page 1 of 1

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

Posted: Mon Jan 03, 2011 2:35 pm
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?

Posted: Mon Jan 03, 2011 2:56 pm
by ray.wurlod
There is no IN available. You need something like

Code: Select all

svYear = #jpCurrentYear# Or svYear = #jpPreviousYear# Or svYear = #jpEarlierYear#

Posted: Mon Jan 03, 2011 3:01 pm
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

Posted: Mon Jan 03, 2011 3:12 pm
by Marley777
Thanks. Let me test these ideas and report back.