This content has been marked as final. Show 5 replies
A better approach might be to figure out a way to get your data without running 27 queries.
In the main everything is in CF is in a struct. Armed with this information you use array notation to help you.
<cfloop index="iCount" from="1" to="27">
<cfset variables["ans" & iCount] = (variables["qryGetPcts" & iCount]["q" & iCount & "Ct"] / qryGetCounts.qID2) * 100>
But as Dan Bracuk rightly points out, you can probably generate this in the db much cleaner and more efficiently when you get the original query.
Not to keep harping on this point, but as mentioned here and in another thread, using a more normalized structure would simplify your code and queries. This design makes things more complicated than they need to be.
Thanks Simon/cf_dev2, I hadn't really looked into this much and threw it together. I'll take a second look.