Skip to main content
Inspiring
May 12, 2009
Answered

CFC Errror -Date

  • May 12, 2009
  • 1 reply
  • 743 views

Error:

The argument ENDDATE passed to function get() is not of type date.If the component name is specified as a type of this argument, the reason for this error might be that a definition file for such component cannot be found or is not accessible. The specific sequence of files included or processed is: C:\Inetpub\wwwroot\Denemeler\Test\connector_test.cfm, line: 11

Any help is appreciated...

<cfcomponent>
<cffunction name="get"  returntype="query">
<cfargument name="DSN" required="true" type="string">
<cfargument name="startDate" required="true" type="date">
<cfargument name="endDate" required="true" type="date">

<cfargument name="qOper" required="true" type="query">
<cfargument name="config" type="array" required="true" hint="Can lists of lists values">


<cfquery name="getCSAT" datasource="#arguments.DSN#">
    SELECT EMPLOYEE_ID, 0 AS Invalid,
    SUM(DTV_SALES)  AS Value
    FROM OPS$SCA_METRIC_SCORE
    WHERE SCORE_DATE between '#DateFormat(arguments.startdate, "dd-mmm-yy")#'
    AND '#DateFormat(arguments.EndDate, "dd-mmm-yy")#'
    AND  EMPLOYEE_ID IN (<cfqueryparam value="#ValueList(arguments.qOper.EID)#" cfsqltype="CF_SQL_VARCHAR" list="Yes">)
    GROUP BY EMPLOYEE_ID
</cfquery>
<cfreturn getCSAT>
</cffunction>
</cfcomponent>

----

<cfscript>
CCConf    = structnew();
CCConf.MyConnector = "orct1";
CCConf.Method = "get";
CCConf.DSN   = application.Orc; //Oracle DSN
CCConf.Sql   = application.Sql; //SQL 05 DSN
CCConf.startDate = "04/01/2009";
CCConf.endDate  = "04/31/2009";
CCConf.Config = arraynew(1);
</cfscript>

This topic has been closed for replies.
Correct answer ilssac

APRIL DOES NOT HAVE 31 DAYS!

4/31/2009 (or any year) is an illegal date and can NOT be converted into a date variable by any code!

1 reply

ilssac
Inspiring
May 12, 2009

emmim44 wrote:

CCConf.startDate = "04/01/2009";
CCConf.endDate  = "04/31/2009";

Technically '04/01/2009' and '04/31/2009' are not dates, they are strings that humans can read as dates.  ColdFusion will do it's best to try and convert strings like these into dates.  Sometimes it has trouble - like when some string tries to tell it the forth month, April, has 31 days.

You may want to investigate something like createData() that more explicity tells CF how to create a date out of values.

emmim44Author
Inspiring
May 12, 2009

I am trying to odbcdate doesnt work... same error. pls guide me.

ilssac
ilssacCorrect answer
Inspiring
May 12, 2009

APRIL DOES NOT HAVE 31 DAYS!

4/31/2009 (or any year) is an illegal date and can NOT be converted into a date variable by any code!