> For the complete documentation index, see [llms.txt](https://docs.advantys.com/workflowgen-administration-module-reference-guide/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.advantys.com/workflowgen-administration-module-reference-guide/workflow-applications/counter.md).

# COUNTER

## Overview

The **COUNTER** workflow application allows you to easily manipulate a counter in a loop.

## How it works

The application requires the `COUNTER` parameter, which will be incremented or decremented depending on your choice.

## Parameters

<table data-full-width="true"><thead><tr><th valign="top">Parameter</th><th width="168.5" valign="top">Type</th><th width="107" valign="top">Direction</th><th valign="top">Description</th></tr></thead><tbody><tr><td valign="top"><code>COUNTER</code></td><td valign="top">NUMERIC</td><td valign="top">IN</td><td valign="top">Counter to manipulate</td></tr><tr><td valign="top"><code>DEFAULT_VALUE</code></td><td valign="top">NUMERIC</td><td valign="top">IN</td><td valign="top">Counter default value; defaults to <code>0</code></td></tr><tr><td valign="top"><code>INCREMENT</code></td><td valign="top">NUMERIC</td><td valign="top">IN</td><td valign="top">The increment value; defaults to <code>1</code>. The value can be negative.</td></tr><tr><td valign="top"><code>RESET</code></td><td valign="top">TEXT</td><td valign="top">IN</td><td valign="top">Indicates whether the counter should be reset to the default value</td></tr><tr><td valign="top"><code>RESET_AT</code></td><td valign="top">NUMERIC</td><td valign="top">IN</td><td valign="top">Indicates whether the counter should be reset when the specified value is reached</td></tr><tr><td valign="top"><code>HAS_RESET</code></td><td valign="top">TEXT</td><td valign="top">OUT</td><td valign="top">Returns <code>Y</code> or <code>N</code> to indicate whether the counter has been reset</td></tr></tbody></table>

## Examples

### Single increment

#### IN

<table><thead><tr><th valign="top">Parameter</th><th valign="top">Value</th></tr></thead><tbody><tr><td valign="top"><code>COUNTER</code></td><td valign="top"><code>0</code></td></tr></tbody></table>

#### OUT

<table><thead><tr><th valign="top">Parameter</th><th valign="top">Value</th></tr></thead><tbody><tr><td valign="top"><code>COUNTER</code></td><td valign="top"><code>1</code></td></tr></tbody></table>

### Single decrement

#### IN

<table><thead><tr><th valign="top">Parameter</th><th valign="top">Value</th></tr></thead><tbody><tr><td valign="top"><code>COUNTER</code></td><td valign="top"><code>0</code></td></tr><tr><td valign="top"><code>INCREMENT</code></td><td valign="top"><code>-1</code></td></tr></tbody></table>

#### OUT

<table><thead><tr><th valign="top">Parameter</th><th valign="top">Value</th></tr></thead><tbody><tr><td valign="top"><code>COUNTER</code></td><td valign="top"><code>-1</code></td></tr></tbody></table>

### Simple reinitialization

#### IN

<table><thead><tr><th valign="top">Parameter</th><th valign="top">Value</th></tr></thead><tbody><tr><td valign="top"><code>COUNTER</code></td><td valign="top"><code>8</code></td></tr><tr><td valign="top"><code>RESET</code></td><td valign="top"><code>Y</code></td></tr></tbody></table>

#### OUT

<table><thead><tr><th valign="top">Parameter</th><th valign="top">Value</th></tr></thead><tbody><tr><td valign="top"><code>COUNTER</code></td><td valign="top"><code>0</code></td></tr><tr><td valign="top"><code>HAS_RESET</code></td><td valign="top"><code>Y</code></td></tr></tbody></table>

### Reset to a specific value

#### IN

<table><thead><tr><th valign="top">Parameter</th><th valign="top">Value</th></tr></thead><tbody><tr><td valign="top"><code>COUNTER</code></td><td valign="top"><code>8</code></td></tr><tr><td valign="top"><code>DEFAULT_VALUE</code></td><td valign="top"><code>5</code></td></tr><tr><td valign="top"><code>RESET</code></td><td valign="top"><code>Y</code></td></tr></tbody></table>

#### OUT

<table><thead><tr><th valign="top">Parameter</th><th valign="top">Value</th></tr></thead><tbody><tr><td valign="top"><code>COUNTER</code></td><td valign="top"><code>5</code></td></tr><tr><td valign="top"><code>HAS_RESET</code></td><td valign="top"><code>Y</code></td></tr></tbody></table>

### Reset when target value is reached

#### IN

<table><thead><tr><th valign="top">Parameter</th><th valign="top">Value</th></tr></thead><tbody><tr><td valign="top"><code>COUNTER</code></td><td valign="top"><code>3</code></td></tr><tr><td valign="top"><code>DEFAULT_VALUE</code></td><td valign="top"><code>0</code></td></tr><tr><td valign="top"><code>RESET_AT</code></td><td valign="top"><code>4</code></td></tr></tbody></table>

#### OUT

<table><thead><tr><th valign="top">Parameter</th><th valign="top">Value</th></tr></thead><tbody><tr><td valign="top"><code>COUNTER</code></td><td valign="top"><code>0</code></td></tr><tr><td valign="top"><code>HAS_RESET</code></td><td valign="top"><code>Y</code></td></tr></tbody></table>
