Page 1 of 1

Fuction

Posted: Thu Apr 13, 2006 7:56 am
by fmartinsferreira
Hi!

My imput in Transformer is '20060413', this is a date in the format(YYYYMMDD). But in some cases I receive '00000001' that is a invalid date.

Well, I would like to make a server routine that when receive the imput check if is a valid or invalid date.

Regards,

Fernando Martins

Posted: Thu Apr 13, 2006 7:59 am
by kcbland
Consider writing a date validation function with range checking, or use a TIME dimension table and validate every date.

Posted: Thu Apr 13, 2006 8:50 am
by ArndW
The Iconv and Oconv functions that do date transformations also return status codes telling if the conversion was successful, successful with warnings or unsuccessful. Using a mask of yyyymmdd the value of "00000001" would return an error, while "00000101" is a valid date.

Posted: Thu Apr 13, 2006 9:58 am
by fmartinsferreira
Thank you every body, but I preferred to make a server routine.
It is in a version 1.0 but work in some cases. :roll:

Follow the code.

DD=Data[8, 2]
MM=Data[6, 2]
AA=Data[2, 4]
RETORNO=Data[1, 9]

If (DD > 0 AND DD < 32) AND (MM > 0 AND MM < 13) AND AA > 1 Then RETORNO=RETORNO
Else RETORNO="000010101"

Ans=RETORNO

Best Regards,

Fernando Martins

Posted: Thu Apr 13, 2006 3:48 pm
by ray.wurlod
Are you really working with a nine character string here? If you are using a five digit year, then the substring extractions will need to be changed.

Fuction

Posted: Tue Apr 25, 2006 3:58 pm
by fmartinsferreira
Sorry :oops: ,

I'm working with 8 character.

Regards,

Fernando
ray.wurlod wrote:Are you really working with a nine character string here? If you are using a five digit year, then the substring extractions will need to be changed. ...