It's because your Counter variable isn't sticking around long enough to be
incrementing... Try setting Counter as an Application variable in your
Application.cfm page like this:
<cfif not isdefined("application.Counter")>
<cfset application.counter=0>
</cfif>
And on your action page, use this:
..do stuff...
<cfset application.counter=application.counter+1>
<cfif (application.counter mod 7) eq 0>
<cfmail...>
</cfif>
Try it on a few dummy pages first. Create a new subdirectory with a simple
CFAPPLICATION tag on a fresh Application page, like:
<cfapplication name="Test123XYZ" setclientcookies="No">
<cfif not isdefined("application.Counter")>
<cfset application.counter=0>
</cfif>
And then plug this in on a Index.cfm page:
<cfset application.counter=application.counter+1>
<cfoutput>application.counter=#application.counter#<br></cfoutput>
<cfif (application.counter mod 7) eq 0>
Generate Email
</cfif>
Browse to that page, and hit refresh 6 times. You'll see the counter increment, and
when it gets to 7 (or a multiple of 7), you'll see "Generate Email".
HTH
~bgl
--> -----Original Message-----
--> From: Clark, Aimee [mailto:[EMAIL PROTECTED]]
--> Sent: Tuesday, November 26, 2002 1:03 PM
--> To: CF-Talk
--> Subject: Using a counter variable
-->
--> I have an application in which I want every 7th record closed in a table
--> to
--> generate an email asking the user to participate in a survey.
-->
--> I have <cfset counter = 0> in the application.cfm file.
-->
--> I have <cfset counter = counter +1> in my action page right after an
--> update
--> that is done to the table.
-->
--> Then I have <cfif counter EQ 7>
--> execute generating email
--> then it resets the counter back to 0
-->
--> However my counter is not incrementing at all. It just keep staying at
--> 1.
--> I'm not sure why. Can someone provide some assistance with this?
-->
--> Thank you,
--> Aimee' Clark
--> Web Developer
--> Stinson Morrison Hecker
-->
-->
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription:
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Your ad could be here. Monies from ads go to support these lists and provide more
resources for the community. http://www.fusionauthority.com/ads.cfm