Skip to main content
Inspiring
May 21, 2009
Question

CF function

  • May 21, 2009
  • 2 replies
  • 1309 views

Hi all,

Error:

If the component name is specified as a return type, the reason for this error might be that a definition file for such component

cannot be found or is  not accessible.

Code:

<cffunction name="getSupLevel" returntype="date">
  <cfargument name="fn" type="string" required="true">
  <cfargument name="ln" type="string" required="true">
    <cfquery name="getSupLoginDate" datasource="#application.DSN#">
      SELECT  loginDate
      FROM user_tbl
      WHERE first_name = <cfqueryparam cfsqltype="CF_SQL_CHAR" value="#arguments.fn#">
      AND  last_name = <cfqueryparam cfsqltype="CF_SQL_CHAR" value="#arguments.ln#">
    </cfquery>
    <cfreturn getSupLoginDate.loginDate>
</cffunction>

  <cfif ccflevelid eq 4 And getSupLevel(first_name,last_name) neq "">
   <cfset newlogdate = getSupLevel(first_name,last_name)>
    <cfelse>
     <cfset newlogdate = #loginDate#>
  </cfif>

This topic has been closed for replies.

2 replies

Participating Frequently
May 22, 2009

That code doesn't generate that error. From the error message it looks

like you have a returntype="something" and ColdFusion can't find the

something component (if the return type is not one of the predefined

types it's assumed to be a component).

Mack

emmim44Author
Inspiring
May 22, 2009

it is not clear what you said. I need to know the answer please

ilssac
Inspiring
May 22, 2009

He said that the code you showed would NOT cause that error.

So we can NOT tell you the answer because we do not know what the answer is.

That error would apply to a function that was told to return an instance of a ColdFusion component, but it can not find the .cfc file that would define the ColdFusion component it was told to return.

Your function is defined to return a basic data type of a date.  It would not create this error.

ilssac
Inspiring
May 21, 2009

Hi.

Is there a question there?

emmim44Author
Inspiring
May 21, 2009

Sorry the question is how to eliminate that error?