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
Clark, Aimee writes:
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
have to admit, I'm still learning the best practices with respect to how
I should be doing this.
-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
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
You haven't made your counter variable persistent. Every time someone makes
a new request of your application, Application.cfm creates a new variable
called counter and sets it equal to 0. You need to make your variable
persistent. And since you want it to work across multiple users, it should
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:
[EMAIL PROTECTED]
Subject: Re: Using a counter variable
Date: Tue, 26 Nov 2002 14:43:48 -0700
Clark, Aimee writes:
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
have to admit, I'm still learning the best practices with respect to how
I should be doing this.
-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
PROTECTED]]
Sent: Tuesday, November 26, 2002 3:41 PM
To: CF-Talk
Subject: RE: Using a counter variable
You haven't made your counter variable persistent. Every time someone makes
a new request of your application, Application.cfm creates a new variable
called counter and sets it equal to 0. You
, 2002 4:42 PM
Subject: RE: Using a counter variable
Mosh,
I tried this and it did work, but, it's still showing my survey link
even though the counter has been set back to 0. Can you tell why?
cflock type=READONLY name=lckReadCounter timeout=20
cfset counter = application.counter
PROTECTED]]
Sent: Tuesday, November 26, 2002 5:42 PM
To: CF-Talk
Subject: RE: Using a counter variable
Mosh,
I tried this and it did work, but, it's still showing my survey link
even though the counter has been set back to 0. Can you tell why?
cflock type=READONLY name=lckReadCounter
cfparam name=application.counter value=0
!-- increment counter --
cfset application.counter = (application.counter + 1) mod 7
cfif counter mod 7 eq 0
!-- increment counter --
Survey Link
/cfif
~|
Archives:
12 matches
Mail list logo