# Counter

This function block keeps a running total of numeric inputs. It is useful for simple accumulations, counters, or integrating values over time. Use the reset input to clear the accumulated value when needed.

## 📥 Inputs <a href="#inputs" id="inputs"></a>

`Number`\
Provide a numeric value to be added to the running total. Each evaluation adds this value to the current accumulation.

`Reset`\
A boolean signal that clears the accumulated total when active (true).

## 📤 Outputs <a href="#outputs" id="outputs"></a>

`Number`\
The current accumulated total after processing the inputs.

## 🕹️ Controls <a href="#controls" id="controls"></a>

This block does not expose additional on-block controls or sliders. It operates based on the provided inputs.

## 🎯 Features <a href="#features" id="features"></a>

* Persistent accumulation of incoming numeric values across evaluations.
* Immediate reset capability via the `Reset` input to start counting from zero.
* Skips disconnected inputs so only active numeric sources affect the total.

## 📝 Usage Instructions <a href="#usage" id="usage"></a>

1. Connect a numeric source to the `Number` input to increase the counter.
2. Use a boolean source on the `Reset` input to clear the counter when needed.
3. Read the current total from the block's `Number` output.

## 📊 How it runs <a href="#evaluation" id="evaluation"></a>

On each run, the block checks the `Number` input and adds it to the stored total. If the `Reset` input is active, the stored total is cleared before continuing. The updated total is emitted through the `Number` output.

## 💡 Tips and Tricks <a href="#tips-and-tricks" id="tips-and-tricks"></a>

* Combine with `Number Input` to manually test counting behavior.
* Use `Logic Input` as a convenient way to trigger the `Reset` signal from the UI.
* Use `Data Memory` to freeze or retain a recorded total under certain conditions.
* Send the output into `CSV Export` or `Data to JSON` to log counts over time for later analysis.
* Visualize numeric changes live by connecting the output to `Scope`.

## 🛠️ Troubleshooting <a href="#troubleshooting" id="troubleshooting"></a>

* No change in total: ensure the `Number` input is connected and producing numeric values. Use `Is None` or `Data Type Converter` if needed to validate inputs.
* Unexpected values or types: insert `Round` or other math operation blocks to sanitize incoming numbers.
* Need periodic persistence: export the output with `CSV Export` or `Data to JSON` so counts are stored outside the scenario.


---

# 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.augelab.com/function-blocks/data-logic/mathmetical-operations/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.
