Set

The Set method takes the name of a counter and an integer, sets the counter to the value of the integer, and returns the new value. If the counter doesn't exist, Counters.Set creates it and sets it to the value of the integer.

To retrieve the value of a counter, use Counters.Get. To increment a counter by 1, use Counters.Increment.

Syntax

Counters.Set(CounterName, int)
 

Parameters

CounterName
A string containing the name of the counter.
int
The new integer value for CounterName.

Example

The following code resets the hit counter pageHits to 0:

<% Counters.Set(pageHits, 0) %> 
 

Applies To

Counter component

See Also

Get, Increment, Remove