Returntype can simply be "datasource", in your example, which specifies the 
type without having to worry about the path, so that may be an option:


<cffunction name="getDatasource" access="public" output="false" 
returntype="datasource">
...

----------------------------------------

From: "Hunsaker, Michael Scott" <[email protected]>
Sent: Thursday, April 07, 2011 10:30 AM
To: "cf-talk" <[email protected]>
Subject: RE: Referencing Variables

Thanks for the input.  So what about using relative paths?  We are 
implementing a stronger development environment and these component 
references will change depending on the server.  We are searching for ways 
to make the code more flexible so we can easily move from one server to 
another.

Thanks for the help!!

Mike

-----Original Message-----
From: Bobby Hartsfield [mailto:[email protected]] 
Sent: Wednesday, April 06, 2011 5:35 PM
To: cf-talk
Subject: RE: Referencing Variables

Nope. Just like the error says, you need a constant value for the 
returntype. Variables are not allowed.

.:.:.:.:.:.:.:.:.:.:.:.:.:.
Bobby Hartsfield
http://acoderslife.com
http://cf4em.com

-----Original Message-----
From: Hunsaker, Michael Scott [mailto:[email protected]]
Sent: Wednesday, April 06, 2011 2:38 PM
To: cf-talk
Subject: Referencing Variables

Hello -

I hope someone can shed some light on this... and if it's possible.  Here 
is
a small chunk of code:

<cffunction name="getDatasource" access="public" output="false"
returntype="sagp.datasource">
<cfreturn variables.datasource />
</cffunction>

In the "returntype", I would like to reference a variable instead of
hardcode the component reference.  So, I would like to end up with this:

<cffunction name="getDatasource" access="public" output="false"
returntype="#application.components#.datasource">
<cfreturn variables.datasource />
</cffunction>

I get an error of "This expression must have a constant value."  Is this
possible?  I would appreciate any help!

Mike

Mike Hunsaker
Systems Analysis Application Development
Kelley School of Business
Bloomington, IN 47405-1703
[email protected]<mailto:[email protected]>
(812) 855-7024



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:343598
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to