If ((Trim(DSLink2.ACCT_OPEN_DT) = '') Or (IsNull((DSLink2.ACCT_OPEN_DT))) Or (IsValidDate( Trim(DSLink2.ACCT_OPEN_DT))= 0 )) Then SetNull() Else StringToDate(Trim(DSLink2.ACCT_OPEN_DT),"%yyyy%mm%dd")
Your warning does not match up to the code you posted... meaning the error shows you using "-" delimiters between the date elements and yet your code as posted does not.
-craig
"You can never have too many knives" -- Logan Nine Fingers
Check the syntax for IsValidDate... I'm assuming it is taking a default since you don't mention the date's format, try adding "%yyyy%mm%dd" to it as well.
-craig
"You can never have too many knives" -- Logan Nine Fingers
I reformated the input string from YYYYMMDD to YYYY-mm-dd in a stage variable and then used the isvaliddate function still not working .. and giving the same error below.
APT_CombinedOperatorController,1: Data string '20000317' does not match format '%yyyy-%mm-%dd': an integer was expected to match tag %dd.
Here is the stage variable
TmpAcctOpDt
If IsNotNull(DSLink2.ACCT_OPEN_DT) And Len( Trim(DSLink2.ACCT_OPEN_DT)) = 8 Then DSLink2.ACCT_OPEN_DT[1,4]:'-':DSLink2.ACCT_OPEN_DT[5,2]:'-':DSLink2.ACCT_OPEN_DT[7,2] Else '0000-00-00'
then used below expression
If IsValidDate(TmpAcctOpDt) Then StringToDate(TmpAcctOpDt,"%yyyy-%mm-%dd") Else SetNull()
As Mike noted, you don't need all that but rather simply switch from IsValidDate (which needs a date not a string) to IsValid with a parameter of "date" and the format string.
-craig
"You can never have too many knives" -- Logan Nine Fingers
kollurianu wrote:APT_CombinedOperatorController,1: Data string '20000317' does not match format '%yyyy-%mm-%dd': an integer was expected to match tag %dd.
This error message is not a result of any of the code you've just posted. I suspect you're looking into the wrong derivation.
Start eliminating derivations until you've isolated it.
chulett wrote:As Mike noted, you don't need all that but rather simply switch from IsValidDate (which needs a date not a string) to IsValid with a parameter of "date" and the format string. ...
Ok..
But does StringtoDate(TmpAcctOpDt,"%yyyy-%mm-%dd") function need the input date value in the yyyy-mm-dd format?