Call it thusly.....

<Cfset datatest =
CreateObject("component","path.to.component.componentname")>
<cfset getQuery = datatest.getQueryFunction(passed parameters if needed)>

<cfoutput query="getQuery">
        #outputFromQuery#
</cfoutput>

--
Scott Stewart
ColdFusion Developer
4405 Oakshyre Way
Raleigh, NC 27616
(h) 919.874.6229 (c) 703.220.2835

-----Original Message-----
From: Don L [mailto:[email protected]] 
Sent: Wednesday, June 10, 2009 12:13 PM
To: cf-talk
Subject: CFfunction within a query output


Are we able to run a cffunction within a cf query output?  Please see below.
Thanks.

Don
Chunshen Li

<cfoutput query="myQuery">
...
  <cfif conditionX eq 1>
        <cffunction name="getProduct" access="public" output="no"
returnType="query">
          <cfargument name="id" type="numeric" required="yes">
                        <cfset var data = "">           
          <cfquery name="data" datasource="myDSN">
              SELECT pname 
              FROM product
              where id=#Arguments.id#
          </cfquery>
          <cfreturn data>                                       
        </cffunction>
  
         #getProduct(3)# <!-- it fails, why? fyi, the datatype of id is int.
-->
 </cfif>
 
</cfoutput> 




~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:323368
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to