Create a coldfusion variable, named using a variable from a looped list
Posted on 2003-03-14
OK, here is what I am trying to do..
I do a query to my iSeries and get a result set.
Now, the information I need right now is the count of number of records grouped by state, but the problem I am running into is that I need to create named variables for each one. Here is the code I am trying to make work (and failing)
<cfparam name="StateList" default="'AZ', 'VA', 'MI'">
<cfloop list="Statelist" index="State">
<cfquery name="GetCountsToday" dbtype="query">
COUNT(*) as NUM
UNDST = '#State#'
<!--- Create variable according to state --->
<cfparam name="1#State#DRS" default="#GetcountsToday.NUM#">
So, as an end result, I need a variable called 1AZDRS that is = to the count for AZ. Any idea's????