# 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="false"><thead><tr><th width="241.46728515625" valign="top">Parameter</th><th width="109.3831787109375" valign="top">Type</th><th width="108.4244384765625" 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>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.workflowgen.com/admin/workflow-applications/counter.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
