# Workflow Application: COUNTER usage

**URL:** <https://discuss.workflowgen.com/t/workflow-application-counter-usage/2261>\
**Category:** Workflow Applications\
**Created:** [December 4, 2024, 9:40pm UTC](https://discuss.workflowgen.com/t/workflow-application-counter-usage/2261 "2024-12-04T21:40:41Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![wfg-admin](https://yyz2.discourse-cdn.com/flex030/user_avatar/discuss.workflowgen.com/wfg-admin/32/714_2.png) [@wfg-admin](https://discuss.workflowgen.com/u/wfg-admin)\
**Post date:** [December 4, 2024, 9:40pm UTC](https://discuss.workflowgen.com/t/workflow-application-counter-usage/2261/1 "2024-12-04T21:40:41Z")

</div>

The COUNTER workflow application allows you to easily manipulate a counter in a loop. The application requires the `COUNTER` parameter, which will be incremented or decremented depending on your choice.

## Parameters

| Name | Type | Direction | Description |
| --- | --- | --- | --- |
| `COUNTER` | NUMERIC | IN | Counter to manipulate |
| `DEFAULT_VALUE` | NUMERIC | IN | Counter default value; defaults to `0` |
| `INCREMENT` | NUMERIC | IN | The increment value; defaults to `1`. The value can be negative. |
| `RESET` | TEXT | IN | Indicates whether the counter should be reset to the default value |
| `RESET_AT` | NUMERIC | IN | Indicates whether the counter should be reset when the specified value is reached |
| `HAS_RESET` | TEXT | OUT | Returns `Y` or `N` to indicate whether the counter has been reset |

## Examples

### Single increment

#### IN

| Parameter | Value |
| --- | --- |
| `COUNTER` | `0` |

#### OUT

| Parameter | Value |
| --- | --- |
| `COUNTER` | `1` |

### Single decrement

#### IN

| Parameter | Value |
| --- | --- |
| COUNTER | `0` |
| INCREMENT | `-1` |

#### OUT

| Parameter | Value |
| --- | --- |
| COUNTER | `-1` |

### Simple reinitialization

#### IN

| Parameter | Value |
| --- | --- |
| COUNTER | `8` |
| RESET | `Y` |

#### OUT

| Parameter | Value |
| --- | --- |
| COUNTER | `0` |
| HAS\_RESET | `Y` |

### Reset to a specific value

#### IN

| Parameter | Value |
| --- | --- |
| COUNTER | `8` |
| RESET | `Y` |
| DEFAULT\_VALUE | `5` |

#### OUT

| Parameter | Value |
| --- | --- |
| COUNTER | `5` |
| HAS\_RESET | `Y` |

### Reset when target value is reached

#### IN

| Parameter | Value |
| --- | --- |
| COUNTER | `3` |
| RESET\_AT | `4` |
| DEFAULT\_VALUE | `0` |

#### OUT

| Parameter | Value |
| --- | --- |
| COUNTER | `0` |
| HAS\_RESET | `Y` |
