I guess I really need some guidance on this problem. I tried putting the
initial creation for this variable on the action page, but then it does the
same thing because when the page runs, it resets the variable back to 0,
then adds 1. Very frustrating.

What should I do? What is the best practice for this type of scenario?

-----Original Message-----
From: Mark A. Kruger - CFG [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, November 26, 2002 3:24 PM
To: CF-Talk
Subject: RE: Using a counter variable


Aimee,

A bit more info would be helpful. Are you trying to do this all in one
request?  what sort of variable is it? session? If it's a session variable
then it's being reset to Zero with every request by the application.cfm
page. You would need to do (with locking):

<cfif NOT isdefined('session.counter')>
        <Cfset counter = 0>
</cfif>

-----Original Message-----
From: Clark, Aimee [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, November 26, 2002 3: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
Signup for the Fusion Authority news alert and keep up with the latest news in 
ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm

Reply via email to