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>
Copy link to clipboard
Copied
Hi.
Is there a question there?
Copy link to clipboard
Copied
Sorry the question is how to eliminate that error?
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
Copy link to clipboard
Copied
it is not clear what you said. I need to know the answer please
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.
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
Copy link to clipboard
Copied
But when i removed that code, I dont get the error..
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
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.
Copy link to clipboard
Copied
Posting the full error message from the start would have helped you
get the answer much quicker.
Mack