the problem isn't the empty query.  an empty query is still a query.  the
problem is you're returning "featured_products" but your query is named
"get_featured_products".  you're returning an empty variable.
change this line:

<cfset var featured_products = "" />

to:

<cfset var get_featured_products = "" />

then change your <cfreturn />  to return get_featured_products.

On Wed, Oct 22, 2008 at 8:51 AM, Rick Faircloth <[EMAIL PROTECTED]>wrote:

> I'm running a query to get "featured products".
>
> For the call, I'm using:
>
> <cfinvoke    component         =    "components.products"
>                   method               =    "select_featured_products"
>                   returnVariable    =    "featured_products"/>
>
> and the cffunction is:
>
> <cffunction   name               =    "select_featured_products"
>                    displayname    =    "select_featured_products"
>                    hint                  =    "Selects Featured Products"
>                    access             =    "remote"
>                    output              =    "false"
>                    returntype        =    "query">
>
>            <cfset var featured_products = "" />
>
>            <cfquery name="get_featured_products"
> datasource="#application.dsn#">
>
>                select        *
>                from           products
>                where        featured    =    1
>
>            </cfquery>
>
>            <cfreturn featured_products />
>
>    </cffunction>
>
> The problem I'm running into happens if there are no featured products
> and the query is empty.  Then I get this error from CF:
>
> "The value returned from the select_featured_products function is not of
> type query."
>
> How should I modify this CFC (or the call) to work with or without query
> values?
>
> Thanks,
>
> Rick
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:314242
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