Try adding the returnType attribute to the getAll function as given below:

        <cffunction name="getAll" access="remote" returnType="query">
        
                <Cfquery name="allInv" datasource="coldfusionwebscom">
                SELECT *
                FROM Inventory          
                </CFQUERY>
                
        
                <cfreturn invAll>
                
        </cffunction>


HTH
Kumaran


-----Original Message-----
From: Stephenie Hamilton [mailto:[EMAIL PROTECTED]] 
Sent: Monday, August 26, 2002 3:07 PM
To: CF-Talk
Subject: Cfc's and undefined variable - why does one work, but not the other

I am playing around with some cfc's to get a better grasp of them on
MX...

Now, one of the methods works fine (category)...one does not (getAll)...
Here is the cfc code (inventory.cfc)
---------------------
<cfcomponent hint="Inventory functionality">

        <!--- list all categories --->
        <cffunction name="Category" hint="Get list of categories">
        
                <cfquery name="getCat" datasource="coldfusionwebscom">
                SELECT *
                FROM Category
                </cfquery>
                
                <cfreturn getCat> 
        </cffunction>
        
        <!--- get all in inventory table --->
        <cffunction name="getAll" access="remote">
        
                <Cfquery name="allInv" datasource="coldfusionwebscom">
                SELECT *
                FROM Inventory          
                </CFQUERY>
                
        
                <cfreturn invAll>
                
        </cffunction>
</cfcomponent>

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

Here are the calls to the methods
--------------------------------------------
Get the cateogries (category):<br><br><br>
 
<cfinvoke component="Inventory" method="Category" returnvariable="cat">
<cfdump var= #cat#>

 
get all inventory (getall):<br>
<br><br>
<cfinvoke component="Inventory" method="getAll"
returnvariable="InvResult"> <cfdump var= #InvResult#>


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

The category method works fine, shows me all the categories... The
getAll does not. It says Error Occurred While Processing Request  
Variable INVALL is undefined.  


You can see this here:

http://coldfusionwebs.com/mxtest/inventory.cfm

What is up with this? They are called the same exact way...the query
allINV is returning 212 records..... Any ideas?
 
~~
Stephenie


______________________________________________________________________
Get the mailserver that powers this list at http://www.coolfusion.com
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to