Page 1 of 1

Invalid Date issue bug

Posted: Wed Nov 19, 2008 4:33 am
by clarcombe
I have a date in the format YYYYMMDD which is tested by the following routine (stolen from Ray's IsValid)

Test1 = Iconv(fieldval, "DYMD[4,2,2]")
Status1 = Status()

When I pass the value 20080931, this passes as valid which is incorrect as September only has 30 days.

When I pass 20080932 this is correctly handled and fails

Bar hardcoding month checks i.e. writing my own routine, is there any other internal function that can be used ?

Posted: Wed Nov 19, 2008 5:28 am
by Romy
Hi,

In the DS Manager there is in build transform to check whether the input date is valid one or not.

Go to Transforms--> SDK-->Date-->Generic. In this you have transform name "DateGenericIsDate". Using this you can check whether the input date is recognised as valid or not. Returns 1 if a good date, 0 if a bad or unrecognised date.

Try this.

Posted: Wed Nov 19, 2008 7:24 am
by clarcombe
Thanks for the suggestion.

I have tried calling this in a routine with the following [not all of the routine is shown below]

Code: Select all

      DEFFUN DateGenericToTimeStamp(InputDate) calling "DSU.DateGenericToTimeStamp"

               Status1 = DateGenericToTimeStamp(fieldval)
               Call DSLogInfo (Status1 ,"ValidLigne")
But I get the following error in Director

Code: Select all

Program "DSU.ValidLigne": Line 88, Unable to open the operating system file "DSU_BP.O/DSU.DateGenericToTimeStamp".
[ENOENT] No such file or directory
Program "DSU.ValidLigne": Line 88, Unable to load file "DSU.DateGenericToTimeStamp".
Program "DSU.ValidLigne": Line 88, Unable to load subroutine.
Attempting to Cleanup after ABORT raised in stage BI1_200_ENT016.PSN_BI_EXCEL___000033_000_BI1_200_ENT016.LectureDonneeDataStage Phantom Aborting with @ABORT.CODE = 3
Can a SDK transform be used in a routine. If not, how can I access it ?

Posted: Wed Nov 19, 2008 8:22 am
by chulett
No, transforms of any kind cannot be used in routines. You need to include their equivalent code into the routine itself.

Posted: Wed Nov 19, 2008 8:25 am
by clarcombe
Any ideas how to get at the code ?

Does the fact that it is in sdk\Date\Generic mean that I can't access it ? I can't seem to find anyway to look at the code

Posted: Wed Nov 19, 2008 8:32 am
by chulett
There is no "code" per se with a transform as they are an interlude to existing routines. Everything they are is in the "Definition" prompt of the Details tab and that's what you'd need to include.

Posted: Thu Nov 20, 2008 2:28 am
by clarcombe
Thats the problem

The definition is DateGenericToTimeStamp(%InputDate%, 0). When I try to include this in my routine it fails with the error mentioned previously.

I have added hardcode which checks the number of days according to the month specified. I haven't included leapyears but too bad.

Posted: Thu Nov 20, 2008 3:41 am
by ray.wurlod
Hang on a minute. The DSU. prefix indicates that it's a Routine - you should be able to see it in your Repository. However the message suggests that it's not there. Can you see it in another project? If so you can export it from there (if read-only object export is enabled) and import it into the project from which it's missing.

Posted: Thu Nov 20, 2008 8:54 am
by chulett
Looks to me that the "DateGenericToTimestamp" routine may not be compiled, as what cannot be found is "DSU_BP.O/DSU.DateGenericToTimeStamp".