> I have a survey-scoring module. They want the ability for > the scores to be dynamically displayed (meaning the overall > scores should not be scored). Everything is ok except this. > Each survey has several categories. Each category has a score > that I calculate. They also want the overall score (the sum of > every category added up). However they want this infomration > on the top of the page. However because the category scores > are not calculated until the page is being generated, I'm > having problems displaying the overall score (sum of call > category scores) on the top. > > Anyway to do this without having to do two loops? I believe > it would be a horrible waste of system resources to have a > loop to calculate the scores first, then do a loop just to > display the info.
There are probably a couple of ways that would work for you. One would be to get the aggregate information as a separate row of data within your query. In SQL Server, you can do this with the WITH CUBE and WITH ROLLUP clauses. This is pretty easy to do, and you'd simply refer to the appropriate "extra" row of data. Another would be to have one CF loop which builds an output string and calculates the total, but doesn't output anything but the total. Then, you'd simply output the generated string below the total. This is easy to do, but kind of tedious, since you have to build a string with the appropriate HTML in it, rather than relying on the ease of use of CFOUTPUT to generate variables within larger HTML strings. Dave Watts, CTO, Fig Leaf Software http://www.figleaf.com/ voice: (202) 797-5496 fax: (202) 797-5444 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Get the mailserver that powers this list at http://www.coolfusion.com FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/[email protected]/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

