I ended up with:
<cfset dummy=SetVariable("qryGet_current_" & param & "_values",
QueryNew(qryGet_current_NT_values.columnlist))>

Just as an aside on the query of a query:
What I wanted was one query for each parameter type so that I wouldn't have
to throw an IF statement around each CFOUTPUT on the render page to search
for a specific row.  

My query was something like 

<cfset param_list="big long list of NT performance metric parameters like
CPU DISK">

<cfloop index="param" list="#param_list#">
        <cfquery name="qryGet_current_#param#_values" datasource="#dsn#"
dbtype="#driver_type#">
                SELECT parametername,instance,value FROM u_parameter_us_cval
                where USERNAME='#session.username#' AND
node='#session.strCurrent_Selection_Instance#'
                AND parametername='#param#'
                ORDER BY INSTANCE
        </cfquery>
</cfloop>

Unfortunately doing a ton of separate queries was really slow, about 5 secs
each.

I changed the parametername match in the WHERE clause to 
        IN ('big long list of parameters')

and then created a sub-query of a query for every element of a column in the
original column.

<cfloop index="param" list="#param_list#">
        <!--- Create a query for each parameter whether or not there is data
for it, saves having to do IsDefined's later on --->
        <cfset dummy=SetVariable("qryGet_current_" & param & "_values",
QueryNew(qryGet_current_NT_values.columnlist))>
        <cfoutput query="qryGet_current_NT_values">
                <cfif qryGet_current_NT_values.parametername EQ param>
                        <!--- Create a row to hold the data--->
                        <CFSET dummy  =
QueryAddRow(evaluate("qryGet_current_" & param & "_values"), 1)>
                        <!--- set the cells in the query --->
                        <CFSET dummy =
QuerySetCell(evaluate("qryGet_current_" & param & "_values"),
"parametername", qryGet_current_NT_values.parametername)>
                        <CFSET dummy =
QuerySetCell(evaluate("qryGet_current_" & param & "_values"), "instance",
qryGet_current_NT_values.instance)>
                        <CFSET dummy =
QuerySetCell(evaluate("qryGet_current_" & param & "_values"), "value",
qryGet_current_NT_values.value)>
                </cfif>
        </cfoutput>
</cfloop>

My render time has dropped from 5 minutes to 5 seconds!
This is probably obvious to the more experienced hands but I'm very happy
with meself!

Thanks,
Kevin

-----Original Message-----
From: John Quarto-vonTivadar [mailto:[EMAIL PROTECTED]]
Sent: Friday, March 09, 2001 2:09 PM
To: CF-Talk
Subject: RE: Dynamic Left-hand side of an assignment? Was: query a
query.



> I get an error about left-hand side assignment when I try something like
> this:
>
> <cfset "qryGet_current_" & param & "_values" =
> QueryNew(qryGet_current_NT_values.columnlist)>
>       or
> <cfset qryGet_current_#param#_values =
> QueryNew(qryGet_current_NT_values.columnlist)>
>

what about the other combination of what you already tried,

<cfset "qryGet_current_#param#_values" =
QueryNew(qryGet_current_NT_values.columnlist)>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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