OK, that's what I've tried but now I'm having problems with creating the
query name on the fly and making assignments to it.
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)>
I tried using evaluate but you can't use function calls on the LHS of an
assignment.
Is it possible to refer to the LHS of an assignment dynamically?
Thanks,
Kevin
For anyone who's curious I ended up with code that will look something like
<!--- Test for the existence of a row that contains a parameter in the list
--->
<cfloop index="param" list="#param_list#">
<!--- Loop through each row in the query --->
<cfoutput query="qryGet_current_NT_values">
<cfif qryGet_current_NT_values.parametername EQ param>
<!--- If
<cfif NOT
IsDefined("qryGet_current_#param#_values")>
<cfset
strQueryName="qryGet_current_#param#_values">
<cfset "qryGet_current_" & param & "_values"
= QueryNew(qryGet_current_NT_values.columnlist)>
</cfif>
<!--- make some rows in the query --->
<CFSET newRow = QueryAddRow(MyQuery,
qryGet_current_NT_values.RecordCount)>
<!--- set the cells in the query --->
<CFSET temp = QuerySetCell(evaluate("strQueryName"),
"parametername", qryGet_current_NT_values.parametername)>
<CFSET temp = QuerySetCell(evaluate("strQueryName"),
"instance", qryGet_current_NT_values.instance)>
<CFSET temp = QuerySetCell(evaluate("strQueryName"),
"severity", qryGet_current_NT_values.severity)>
</cfif>
</cfoutput>
</cfloop>
-----Original Message-----
From: Hayes, David [mailto:[EMAIL PROTECTED]]
Sent: Thursday, March 08, 2001 5:57 PM
To: CF-Talk
Subject: RE: Anyone know of a custom tag to query a query ?
I don't know of a custom tag, but if you use Query functions, you can fake
it.
Use QueryNew(myCFQUERY.columnlist) to create a new query object.
Then iterate through your CFQUERY and check for whichever values you want.
You can get clever by using valueList on your CFQUERY object to create
lookup lists; you could then get a listposition from the lookup list, and
use that as the startRow attribute for a CFOUTPUT of your created query
object.
<grin> At least, it sounds like it should work. It's hard to suggest the
best solution without knowing the amount of data involved.
Dave
-----Original Message-----
From: Kevin Gilchrist [mailto:[EMAIL PROTECTED]]
Sent: Thursday, March 08, 2001 4:33 PM
To: CF-Talk
Subject: Anyone know of a custom tag to query a query ?
Hi,
I know this will be included in CF 5.0 but unfortunately that won't be
around soon enough.
Before I haul off and try to write something to do this, does anybody know
of a custom tag that will query a query?
I've browsed through Allaire's tag gallery and while there are a number of
tags that will manipulate queries there's nothing that gets a subset of data
from an existing query.
I'd written a lot code that performed lots of small single queries which
made the data more accessible to me in terms of variable granularity, i.e.
one query name per small query but due to bad performance our DBA
recommended that I reduce the number of queries by being less specific and
parse the data on the CF side.
Thanks,
Kevin
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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