Page 1 of 1

compare of 2 values

Posted: Mon Jul 07, 2008 5:21 am
by Tlam
Hi,

Please advice on following situation.

I have a value coming from the source which normally should look like this '20080701' or '20071105' but sometimes they delivered this '20080000'. I want to build a check in the stage variables to exclude these incorrect values. Please advice me how to check only on the last 4 digits? reject when the last 4 digits is 0000.

Thanks in advance

Posted: Mon Jul 07, 2008 5:59 am
by ArndW
Put a constraint of "RIGHT(In.DateColumn,4)<>'000'"

Re: compare of 2 values

Posted: Mon Jul 07, 2008 6:04 am
by poornima.chandramouli
Tlam wrote:Hi,

Please advice on following situation.

I have a value coming from the source which normally should look like this '20080701' or '20071105' but sometimes they delivered this '20080000'. I want to build a check in the stage variables to exclude these incorrect values. Please advice me how to check only on the last 4 digits? reject when the last 4 digits is 0000.

Thanks in advance
The values was seems to be a date value,first u have to take the last 2 digits by using Right(column_name,2) function & chk whether it is less than 31 & then take the last 4 digits by using Left(Right(column_name,4),2) & chk whether it is less than 12.
Check for both these conditions,if both are not satisfied then reject the records by placing it in a constraint.

Posted: Mon Jul 07, 2008 6:09 am
by rajendharreddy
Simple could be, in constraint check for Right(column_name,4)=0000, then reject the rows.

Posted: Mon Jul 07, 2008 6:24 am
by Tlam
Thanks all for your help. I found it as well, i forgot how to search and suddenly realize :oops:

Posted: Mon Jul 07, 2008 2:53 pm
by ray.wurlod
If you want to search for "valid date" it's a slightly different approach. Use something like

Code: Select all

Oconv(Iconv(InLink.TheDate,"DYMD"),"DYMD[4,2,2]":@VM:"MCN") <> InLink.TheDate