• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

CF function

Participant ,
May 21, 2009 May 21, 2009

Copy link to clipboard

Copied

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>

TOPICS
Advanced techniques

Views

990

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
May 21, 2009 May 21, 2009

Copy link to clipboard

Copied

Hi.

Is there a question there?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
May 21, 2009 May 21, 2009

Copy link to clipboard

Copied

Sorry the question is how to eliminate that error?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
May 22, 2009 May 22, 2009

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
May 22, 2009 May 22, 2009

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
May 22, 2009 May 22, 2009

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
May 22, 2009 May 22, 2009

Copy link to clipboard

Copied

it is not clear what you said.

The error message does not seem to be related to the code you posted

(you're returning a date but the error message is about a component).

My guess is that the problem is another function in a CFC (the same or

another CFC) - it's return type is a component that cannot be found.

Mack

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
May 22, 2009 May 22, 2009

Copy link to clipboard

Copied

But when i removed that code, I dont get the error..

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
May 22, 2009 May 22, 2009

Copy link to clipboard

Copied

Please paste the complete error message (including the stack trace).

Is it possible that the code you removed is also calling another function ?

Also, please read this

http://catb.org/esr/faqs/smart-questions.html#beprecise, it will help

you get better answers.

Mack

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
May 22, 2009 May 22, 2009

Copy link to clipboard

Copied

The error was on the function return type which should be string instead of date... Thank u for your efforts though.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
May 22, 2009 May 22, 2009

Copy link to clipboard

Copied

LATEST

Posting the full error message from the start would have helped you

get the answer much quicker.

Mack

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation