Page 1 of 1

How to check the white spaces in a field of Char 40 Bytes

Posted: Mon Jun 16, 2008 12:14 pm
by nsubbarao
Hi All,

I have a field named AREA2 ( char 40 bytes). Say it has the following value " JT4VN13G4W36280604 98686" and I need to check whether the first 2 bytes are spaces and replace it with another string say "AB'.

I tried the following in my transformation.
If AREA2 [1,2] = ' '
then (AREA2 [1,1] : "AB" : AREA2 [4,37])
Else AREA2

and also this
If Alpha(AREA2 [1,2]) = 0
then (AREA2 [1,1] : "AB" : AREA2 [4,37])
Else AREA2

But I am not able to replace the spaces with "AB". Please help.

Posted: Mon Jun 16, 2008 12:55 pm
by Krazykoolrohit
try the following:

If left(AREA2,2) = ' '
then ('AB':right(AREA2,len(AREA2)-2) )
Else AREA2