I've built a search form in ColdFusion 8 which allowing users to choose whether or not they want the results grouped by record type. If they choose yes, then I display the returned data within a cfoutput tag using the "group" attribute:
<cfoutput query="queryName" group="recordType">
For code efficiency, I would like to use the same <cfoutput> tag, whether or not the results are grouped. I cannot leave the group attribute empty, and I haven't found the logic that would allow me to alter or repeat only the opening <cfoutput> tag, including the group attribute in one and not in the other.
Unless I've missed something (which is always highly possible), the only way to avoid repeating the entire <cfoutput> tag (about 100 lines of code), grouping data in one and not in the other, would be to use the group attribute regardless of the user's selection. I could do this, since each row in either result set contains a unique ID value. I would set the default value for a "groupBy" variable to "uniqueID" and overwrite it with "recordType" when a user wants to group the data.
My question ... would I be taking a significant performance hit by doing this? There'd essentially be one row per group, and I don't know if ColdFusion processing involved would impact performance. The data set would have about 10 columns and could be as large as 8,000 records.