set a counter var and increment it inside the inner <cfoutput>

<cfoutput group="foo">
     <cfset counter = 0 />
     <cfoutput> <!--- begin inner cfoutput --->
          <cfset counter = counter + 1 />
          <cfif counter MOD 2 EQ 0>
               do stuff
           <cfelse>
               do other stuff
           </cfif>
     </cfoutput>
</cfoutput>

On 12/21/06, Richard Dillman <[EMAIL PROTECTED]> wrote:
> Im trying to make a table output grouped query info.
> Then i want to make a 2 column list of the grouped data within. Dynamically
> generating the Tr's in the right spots.
>
> I'm finding that using MOD wont work because i never know where ill be
> starting the row at after the title....
>
> Any thoughts?
>
> <cfquery name="Services" datasource="#DSN#" username="#dbusername#"
> password="#dbpassword#">
>   Select TYPE, NAME, ID
>   from BUSINESS
>   Order by TYPE ASC
> </cfquery>
> <table>
> <cfoutput query="Services" group="TYPE">
>   <tr>
>     <th colspan="2" class="title">
>    #TYPE#
>  </th>
>   </tr>
> <cfoutput>
>   <cfif Services.currentrow mod 2 eq 1>
>     <tr>
>   </cfif>
>     <td>
>    #NAME#
>     </td>
>   <cfif Services.currentrow mod 2 eq 0>
>     <tr>
>   </cfif>
>  </cfoutput>
> </cfoutput>
> </table>
>
> --
> --
> Richard Dillman
> [EMAIL PROTECTED]
> (317) 916-8341
>
> "If you want happiness for an hour -- take a nap.
> If you want happiness for a day -- go fishing.
> If you want happiness for a month -- get married.
> If you want happiness for a year -- inherit a fortune.
> If you want happiness for a lifetime -- help someone else."
> -- Chinese proverb --
>
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Create robust enterprise, web RIAs.
Upgrade & integrate Adobe Coldfusion MX7 with Flex 2
http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:264854
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to