Page 1 of 1
IS VALID () Fatal error message
Posted: Wed Apr 08, 2009 11:06 am
by gsym
Hey,
the following code I have in transformer
if IsValid('Date', StringToDate("99991235" ,"%yyyy%mm%dd"))= 0 then setnull() else StringToDate("99991225" ,"%yyyy%mm%dd")
The result, its setting null correctly but I am getting a warning and a FATAL message. The following are the messgaes
Warning :
APT_CombinedOperatorController,0: Conversion error calling conversion routine date_from_string data may have been lost
Fatal:
Data string '**********' does not match format '%yyyy-%mm-%dd': an integer was expected to match tag %yyyy.
O/p result:
Peek_6,0: date:NULL
may i know how do u eliminate this Warning and fatal error??
Re: IS VALID () Fatal error message
Posted: Wed Apr 08, 2009 11:23 am
by priyadarshikunal
gsym wrote:Hey,
the following code I have in transformer
if IsValid('Date', StringToDate("99991235" ,"%yyyy%mm%dd"))= 0 then setnull() else StringToDate("99991225" ,"%yyyy%mm%dd")
The result, its setting null correctly but I am getting a warning and a FATAL message. The following are the messgaes
Warning :
APT_CombinedOperatorController,0: Conversion error calling conversion routine date_from_string data may have been lost
Fatal:
Data string '**********' does not match format '%yyyy-%mm-%dd': an integer was expected to match tag %yyyy.
O/p result:
Peek_6,0: date:NULL
may i know how do u eliminate this Warning and fatal error??
Do you have any character string in your input data.
probably ******** if its the same message in your log.
In case of character string the StringToDate() will fail.
Try validating it before passing it to the function if its 8 character long numeric.
Posted: Wed Apr 08, 2009 11:36 am
by gsym
hey ,
thanks for ur reply,
I have hard coded the value and it is 8 character.
For example:
StringToDate("99991235" ,"%yyyy%mm%dd")
I am validating the I/P value is valid date or not, if yes do conversion else setnull()
Posted: Wed Apr 08, 2009 12:58 pm
by kduke
IsValid is expecting a string not a date. Take the StringToDate out of your expression.
Tried with string and still getting error
Posted: Wed Apr 08, 2009 1:28 pm
by gsym
kduke wrote:IsValid is expecting a string not a date. Take the StringToDate out of your expression. ...
Did you mean to say:
if IsValid('Date', '99991235' ) = 0 then setnull() else StringToDate("99991225" ,"%yyyy%mm%dd")
if yes, I am still getting fatal error as
Data string '99991235' does not match format '%yyyy-%mm-%dd': an integer was expected to match tag %dd.
Posted: Wed Apr 08, 2009 1:45 pm
by ray.wurlod
35 is not a valid day number, this is what it's telling you.
Posted: Wed Apr 08, 2009 1:50 pm
by Mike
What is the default date format for your installation? The IsValid function is probably expecting the date in that format. From the error message it seems that your default format must be "%yyyy-%mm-%dd".
Does this work for you?
Code: Select all
If IsValid("date", "9999-12-35") = 0 then SetNull() else StringToDate("99991225" ,"%yyyy%mm%dd")
Mike
Posted: Wed Apr 08, 2009 2:00 pm
by gsym
Mike wrote:What is the default date format for your installation? The IsValid function is probably expecting the date in that format. From the error message it seems that your default format must be "%yyyy-%mm-%dd".
Does this work for you?
Code: Select all
If IsValid("date", "9999-12-35") = 0 then SetNull() else StringToDate("99991225" ,"%yyyy%mm%dd")
Mike
You were right, Actually I tried this and wanted to post back that its resolved, But found you have already posted it......
Thanks guys