# Statistic

Numeric statistics can return data from scripts and APIs and display values with some amount of formatting options.&#x20;

## Display a statistic from an API

APIs should return a single value to display as a statistic. An example API could look something like this.&#x20;

```
Get-Random -Min 100 -Max 1000
```

You can then select the API under the data source tab.&#x20;

![](/files/-Mj1NfS2SV_rS8tmWq_I)

Each time the page is loaded, the API is called and the random value is shown.&#x20;

![](/files/-Mj1NqAwMQRqdBKibvr9)

## Display a statistic from a Script

Statistics shown from scripts will display the value return by the last job run for the script. Loading the page will not run the script again.&#x20;

We will use this script as an example.

```
Get-Random -Min 100 -Max 1000
```

Select the script on the data source tab.&#x20;

![](/files/-Mj1OEGD4WJp5LacoYhp)

The statistic will be shown on the page based on the output of the script. You'll notice that refreshing the page does not change the value of the statistic unless the job is run again.&#x20;

![](/files/-Mj1OL5-tdWI7ANI82Jc)

## Customizing the Statistic

You can customize features such as the prefix, suffix, precision and whether to auto-reload the statistic on an interval.&#x20;

![](/files/-Mj1Ol5zv_beGYM6IuMq)

![](/files/-Mj1OpezGY9eHKQkojBE)

## Properties

| Property             | Description                                                | Available Since |
| -------------------- | ---------------------------------------------------------- | --------------- |
| ID                   | The ID of this component                                   | 2.2.0           |
| Title                | The text to display within the statistic.                  | 2.2.0           |
| Data Source          | The script or API to call to return the statistic's value. | 2.2.0           |
| Prefix               | The string to display before the value.                    | 2.2.0           |
| Suffix               | The string to display after the value.                     | 2.2.0           |
| Auto Reload          | Whether to auto-reload the statistic on an interval.       | 2.2.0           |
| Auto Reload Interval | The number of seconds between auto-reloads.                | 2.2.0           |
| Precision            | The number of decimal places to display in the value.      | 2.2.0           |


---

# 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.powershelluniversal.com/v3/userinterfaces/pages/statistic.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.
