I'm pretty sure cfoutput only accepts variables.

Blair

On Tue, Feb 23, 2010 at 11:08 AM, nkosi <[email protected]> wrote:

> Hi All,
>
> This is more of an observation rather than a call for help.
>
> Does anyone know why, if I attempt to call a method in the 'query'
> parameter of <cfoutput> it errors? It also errors when using <cfloop
> query="{method call here}">
>
> e.g.
> <cfset obj = CreateObject("component", "test")>
>
> <cfoutput query="obj.getStuff()"><!--- This is where the error is
> thrown --->
>        #id# - #month#<br />
> </cfoutput>
>
> I assume it has something to do with the way (sequence?) CF implements
> cfoutput and method calls. This assumption is based on the fact that I
> can successfully call the method in a <cfif>
>
> e.g.
> <cfif obj.getStuff().recordcount gt 1>
>        <p>More than 1.</p>
> </cfif>
>
> My test.cfc looks a little something like this ...
> <cfcomponent>
>        <cffunction name="getStuff" access="public" returntype="query">
>                <cfset var qryStuff =
> QueryNew("id,month","integer,varchar")>
>
>                <!--- Add 12 rows to the query --->
>                <cfset QueryAddRow(qryStuff,12)>
>
>                <!--- Loop over the rows and populate the table with month
> data --->
>                <cfloop query="qryStuff">
>                        <cfset QuerySetCell(qryStuff,"id", currentrow,
> currentrow)>
>                        <cfset QuerySetCell(qryStuff,"month",
> MonthAsString(currentrow),
> currentrow)>
>                </cfloop>
>
>                <cfreturn qryStuff>
>        </cffunction>
> </cfcomponent>
>
> BTW - I have only tested this on a CF8 developer instance.
>
> Cheers
> Glen
>
> --
> You received this message because you are subscribed to the Google Groups
> "cfaussie" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<cfaussie%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/cfaussie?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"cfaussie" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/cfaussie?hl=en.

Reply via email to