Page 1 of 1

begins with function

Posted: Mon Sep 04, 2006 11:04 pm
by parvathi
Hi all,
Are there any datastage functions like begins with or ends with ...
I just want to check in the transformer that whether a certain coulmn begins with a particular word...

Posted: Mon Sep 04, 2006 11:18 pm
by rasi
Hi

do you mean Datastage reserved words. Please be more clear.

Re: begins with function

Posted: Mon Sep 04, 2006 11:24 pm
by balajisr
parvathi wrote:Hi all,
Are there any datastage functions like begins with or ends with ...
I just want to check in the transformer that whether a certain coulmn begins with a particular word...
There is a function named "Matches". Check that out.

Posted: Tue Sep 05, 2006 1:09 am
by parvathi
yes datastage reserved words ..
The scenario is as follows ..
i have to compare an input column in the transformer and check whether that column starts with the "begin" or "end" and then i have to do some more operations....

Posted: Tue Sep 05, 2006 1:17 am
by rasi
Hi Parvathi

Use Constraint in transformer and inside that type the condition (eg InputColumn = 'begin' Or InputColumn = 'end'). This will only allow records with your conditions.

You can also have the same logic applied in your transformer expression using If clause.

If InputColumn = 'begin' Or InputColumn = 'end' Then Expression1 Else Expression2

Posted: Tue Sep 05, 2006 2:59 am
by parvathi
thanks ... i was to do with that idea

Posted: Tue Sep 05, 2006 7:04 am
by chulett
rasi wrote:If InputColumn = 'begin' Or InputColumn = 'end' Then Expression1 Else Expression2
Um... that doesn't check that the field starts with those values, that checks if they are equal to those values.

Substring would be one way:

Code: Select all

If InputColumn[1,5] = 'begin' Or InputColumn[1,3] = 'end' Then Expression1 Else Expression2

Posted: Tue Sep 05, 2006 4:41 pm
by ray.wurlod
There are Left() and Right() functions available. Using these would make the meaning in your expression pellucid.

Posted: Tue Sep 05, 2006 7:49 pm
by rasi
Sorry Craig

I missed the substring....

Posted: Tue Sep 05, 2006 8:47 pm
by chulett
ray.wurlod wrote:Using these would make the meaning in your expression pellucid.
As noted, substring was just one way... these are another. To be transparently clear. :wink:

Posted: Wed Sep 06, 2006 3:05 am
by parvathi
thanks a lot to everyone and to their valuable ideas.... I tried with all the options...