Page 1 of 1

Problem in defining one business rule in transformer

Posted: Thu Mar 12, 2009 2:46 am
by shalini11
Hi All,

I have to give one condition in transformer. I am using a stage variable to do this.But the job is getting aborted because of that particular condition.I am not able to find out whats wrong in the below condition.

If Trim(Move_Xfm.Make)='Chevrolet' And Trim(Move_Xfm.Model)='Impala' And Trim(Move_Xfm.ModelYear) >='2006' And Trim(Move_Xfm.prfx) [4,2]= 'WS' Then 'E'

Else If (Trim(Move_Xfm.Make)='Chevrolet' Or Trim(Move_Xfm.Make)='GMC') And Trim(Move_Xfm.ModelYear) > '2007' And (Trim(Move_Xfm.prfx) [5,2]= 'C0' Or Trim(Move_Xfm.prfx) [5,2]= 'K0') Then 'E' Else ''


Can anybody help me out.

Thanks

Posted: Thu Mar 12, 2009 3:00 am
by ray.wurlod
Advise the data types of all the fields mentioned in the expression. Without that we can't really help.

Posted: Thu Mar 12, 2009 3:03 am
by shalini11
All are VARCHARs

Posted: Thu Mar 12, 2009 3:09 am
by Sainath.Srinivasan
Try a Trim(Variable[from,len]) rather than Trim(Variable)[from,len].

Posted: Thu Mar 12, 2009 3:14 am
by shalini11
Thank you Sir,

It worked.
Such a small thing and it created a havoc.

Can you explain me what's the difference in writing Trim(Variable[from,len]) and Trim(Variable)[from,len].

Re: Problem in defining one business rule in transformer

Posted: Thu Mar 12, 2009 3:15 am
by s_boyapati
shalini11 wrote:Hi All,

I have to give one condition in transformer. I am using a stage variable to do this.But the job is getting aborted because of that particular condition.I am not able to find out whats wrong in the below condition.

If Trim(Move_Xfm.Make)='Chevrolet' And Trim(Move_Xfm.Model)='Impala' And Trim(Move_Xfm.ModelYear) >='2006' And Trim(Move_Xfm.prfx) [4,2]= 'WS' Then 'E'

Else If (Trim(Move_Xfm.Make)='Chevrolet' Or Trim(Move_Xfm.Make)='GMC') And Trim(Move_Xfm.ModelYear) > '2007' And (Trim(Move_Xfm.prfx) [5,2]= 'C0' Or Trim(Move_Xfm.prfx) [5,2]= 'K0') Then 'E' Else ''


Can anybody help me out.

Thanks
Also consider providing initial values to stage variables, will help you...

Posted: Thu Mar 12, 2009 3:31 pm
by ray.wurlod
shalini11 wrote:Thank you Sir,

It worked.
Such a small thing and it created a havoc.

Can you explain me what's the difference in writing Trim(Variable[from,len]) and Trim(Variable)[from,len].
The obvious difference is where Variable contains leading trimmable characters. The first syntax strips the first len characters (whatever they are) and trims the remainder. The second syntax trims the trimmable characters before performing the substring operation.