Page 1 of 1

Setting default date value

Posted: Mon Jun 04, 2007 9:06 am
by lsnovick
I need to set a default value into a timestamp field. This does not work:

If IsNull(lnk_PassMbrId.END_DT) Then StringToTimestamp('9999-12-31 00:00:00',"%yyyy-%mm-%dd HH:MM:SS") Else lnk_PassMbrId.END_DT


Any idea on what gets it to work?

Thanks.

Posted: Mon Jun 04, 2007 9:16 am
by DSguru2B
Your time format is not correct. Put the following in the format mask

Code: Select all

"%yyyy-%mm-%dd %hh:%nn:%ss"

Posted: Mon Jun 04, 2007 9:23 am
by Edwink
Can you post the error message?

Posted: Mon Jun 04, 2007 11:02 am
by lsnovick
APT_CombinedOperatorController,0: Fatal Error: Attempt to setIsNull() on the accessor interfacing to non-nullable field "END_DT".

If IsNull(lnk_PassMbrId.END_DT) Then StringToTimestamp('9999-12-31 00:00:00',"%yyyy-%mm-%dd hh:nn:ss") Else lnk_PassMbrId.END_DT

Posted: Mon Jun 04, 2007 11:07 am
by Edwink
hope DSguru2B reply would solve your problem :)

Posted: Mon Jun 04, 2007 11:22 am
by lsnovick
Nope. I tried that too.

If IsNull(lnk_PassMbrId.END_DT) Then StringToTimestamp('9999-12-31 00:00:00',"%yyyy-%mm-%dd %hh:%nn:%ss") Else lnk_PassMbrId.END_DT

Posted: Mon Jun 04, 2007 11:54 am
by DSguru2B
What is the error that you got when you applied my method? Are you sure that your incoming empty column is infact NULL and not an empty space?

Posted: Mon Jun 04, 2007 12:00 pm
by lsnovick
I fixed it by renaming the field coming in and it worked. That is so weird that I can't even understand how it works now. :evil: :evil: