Get

The Get method takes the name of a counter and returns the current value of the counter. If the counter doesn't exist, the method creates it and sets it to 0.

Syntax

Counters.Get(CounterName)

 

Parameters
CounterName
A string containing the name of the counter.
Example

Display the value a counter with <%= Counters.Get(CounterName) %>. Assign the value of the counter to a variable with <% countervar = Counters.Get(CounterName) %>.

The following script displays the vote tally from a poll about favorite colors.

<% 
  If colornumber = "1" Then 
    Counters.Increment("greencounter") 
  Else 
    If colornumber = "2" Then 
      Counters.Increment("bluecounter") 
    Else 
      If colornumber = "0" Then 
        Counters.Increment("redcounter") 
      End If 
    End If 
  End If 
%>
<P>Current vote tally:
<P>red: <% =Counters.Get("redcounter") %>
<P>green: <% = Counters.Get("greencounter") %> 
<P>blue: <% = Counters.Get("bluecounter") %>
 
See Also

Increment, Remove, Set