> I had a group column set dynamically for an output query, based on whether
> a form variable was passed into the template, as follows:
>
> <cfif parameterexists(icat)>
> <cfset queryGroup = 'ItemCategory'>
> <cfelse>
> <cfset queryGroup = 'Category'>
> </cfif>
>
> The variable, "queryGroup," is used in the output query, as: <cfoutput
> query="getMainList" group=#queryGroup#> , and this works fine.
>
> Now, I have a situation where, if I pass in another form variable, I don't
> want grouping, so I need to include the whole grouping string, instead of
> just variable for which column to use. The following works in a CFOUTPUT,
> but not in a CFOUTPUT QUERY:
>
> <cfset queryGroup = 'group="ItemCategory"'>
> <cfoutput>#queryGroup#</cfoutput>
>
> I've tried all sorts of variations on:
> <cfoutput query="getMainList" #queryGroup#>, but I get an "Invalid token"
> error as soon as I get to a # or < (as in a CFIF at this position).
>
> Any suggestions? I suppose I could use a CFIF statement and have two
> versions of the CFOUTPUT, but I'd rather have dynamic text within one.

Gods, you did no testing before sending this, did you?

<cfif parameterexists(icat)>
        <cfset queryGroup = 'ItemCategory'>
<cfelse>
        <cfset queryGroup = 'Category'>
</cfif>
<cfoutput query="myQuery" group="#queryGroup#">
        <cfoutput>
        </cfoutput>
</cfoutput>

Just remember to sort it properly in the database before the output

Philip Arnold
Director
Certified ColdFusion Developer
ASP Multimedia Limited
T: +44 (0)20 8680 1133

"Websites for the real world"

**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.
**********************************************************************


> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Sent: 27 February 2001 16:31
> To: CF-Talk
> Subject: Dynamic group in output query
>
>
>
> TIA,
> --John
>
>
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to