Your init method is not returning anything back. When you say this

<cfset finObj =
createObject("component","queries.QRY_financial").init(myDsn)>

You are saying return to me what the init method returns. Usually this is an
instance of the component such as


        <cffunction name="init" access="public" output="false"
returntype="Financial">
               <cfargument name="dsn" type="string" required="true">
               <cfscript>
                      setDsn(arguments.dsn);
               </cfscript>
               <cfreturn this>
        </cffunction>

Also I would look into some naming conventions and uses for cfcs. A cfc is
not really meant to be used as a query collection but more as a represention
of real world objects. If you are new to cfc's this is completely
understandable but other than that looks great. Change the return and that
finObj should now have access to your methods.

Dan Vega
http://www.danvega.org



On 1/5/07, Martin Thorpe <[EMAIL PROTECTED]> wrote:
>
> Now this is something that really bugs me and I have never managed to
> get working with CFCs.
>
>
>
> What I have is a cfc like this:
>
>
>
> <cfcomponent name="QRY_financial" displayname="financial stuff"
> hint="get common financial data">
>
>         <cfproperty name="dsn" displayname="datasource" hint="the
> datasource name" type="string" />
>
>         <cffunction name="init" access="public" output="false"
> returntype="void">
>                <cfargument name="dsn" type="string" required="true">
>                <cfscript>
>                       setDsn(arguments.dsn);
>                </cfscript>
>         </cffunction>
>
>         <cffunction name="getDsn" access="public" output="false"
> returntype="string">
>                <cfreturn dsn />
>         </cffunction>
>
>         <cffunction name="setDsn" access="public" output="false"
> returntype="void">
>                <cfargument name="dsn" type="string" required="true" />
>                <cfset dsn = arguments.dsn />
>                <cfreturn />
>         </cffunction>
>
> ......more stuff
>
>
>
>
>
> Which I think I should be able to call like this as I have seen all over
> the web.
>
> <cfset finObj =
> createObject("component","queries.QRY_financial").init(myDsn)>
>
> <cfdump var="#finObj.getDsn()#">
>
>
>
> But when I do this I get an error from the Cfdump that:
>
>             Variable finObj is undefined
>
>
>
> Now I have tried it a number of ways, without the specific init function
> and calling the setDsn like this
>
> <cfset finObj =
> createObject("component","queries.QRY_financial").setDsn(myDsn)>
>
>
>
> No joy here just the same thing.  I feel that I am missing out on
> something fundamental here, can someone give me a tip or a hint as to
> what I am doing wrong.
>
>
>
> Thanks for reading.
>
>
>
> Cheers
>
> Martin
>
>
>
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Create robust enterprise, web RIAs.
Upgrade & integrate Adobe Coldfusion MX7 with Flex 2
http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:265788
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to