From e11c2f8cdb5153b215bf3e52cd29d84763a537b5 Mon Sep 17 00:00:00 2001 From: Oleg Khalkov Date: Fri, 24 Oct 2025 19:32:15 +0300 Subject: [PATCH 1/2] Improve docs Widgets (Data keys - Data post-processing function) Affects: /docs/pe/user-guide/widgets/#data-post-processing-function --- _includes/docs/user-guide/widgets.md | 31 ++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/_includes/docs/user-guide/widgets.md b/_includes/docs/user-guide/widgets.md index 90d830661a..be635d5cc5 100644 --- a/_includes/docs/user-guide/widgets.md +++ b/_includes/docs/user-guide/widgets.md @@ -152,7 +152,7 @@ A data key identifies the telemetry, attribute, or entity field a widget should Sources of keys - **Attributes** — the combined set of Client, Server, and Shared [attributes](/docs/{{docsPrefix}}user-guide/attributes/){:target="_blank"} of the selected entity. If a needed attribute doesn't exist yet, you can still add the key; the widget will show data once the device reports it. -- **Time series** — telemetry keys reported by devices or written by the Rule Engine / [REST API](/docs/{{docsPrefix}}reference/rest-api/){:target="_blank"}. +- **Time series** — telemetry keys reported by devices or written by the [Rule Engine](/docs/{{docsPrefix}}user-guide/rule-engine-2-0/overview/){:target="_blank"} / [REST API](/docs/{{docsPrefix}}reference/rest-api/){:target="_blank"}. - **Entity fields** — metadata fields that depend on entity type and may evolve over time (e.g. created time, entity type, name, type, label). The data keys list for data source depends on the [widget type](/docs/{{docsPrefix}}user-guide/widgets/#widget-types){:target="_blank"}: @@ -222,9 +222,9 @@ Let's look at the basic data key settings an example of the "Entities table" {% include images-gallery.html imageCollection="data-key-configuration-color" %} -- **Use data post‑processing function** — enable a custom function to transform raw values before display. +- [**Use data post-processing function**](#data-post-processing-function) — enable a custom function to transform raw values before display. -**Aggregation of key** +##### Aggregation of key By default, the Latest values widgets do not have the time window. If you enable aggregation for any data key in the **Latest values** widgets, the time window control will appear. You can set up aggregation for each telemetry @@ -305,7 +305,30 @@ This option allows you to specify how the result should be displayed: - **Delta (percent)** - Displays the result as a percentage relative to the previous interval
formula: **(IntervalValue - prevIntervalValue)/prevIntervalValue*100** -**Use data post-processing function.** The data post-processing function allows changing the output data depending on your wishes. To use data post-processing function, you must check the "Use data post-processing function" checkbox and enter the function in the field below. Then click the "Save" button in the lower-right corner. +##### Data post-processing function +The data post-processing function enables real-time transformation of incoming telemetry values before they are displayed +in widgets. This feature allows you to apply custom JavaScript logic to each data point — for example, convert units, +filter out anomalies, or calculate derived metrics without touching upstream sources. + + **How to use:** + - In the widget → go to **Series** section → click the **Pencil** icon next to the data key. + - Enable toggle **Use data post-processing function**. + - Enter your code in the function body. The platform automatically injects the function header: +
**function** (time, value, prevValue, timePrev, prevOrigValue) { +
**`YOUR_JS_CODE`** +
} + - Click **Save** button. + +**Once enabled, the function has access to the following parameters:** + +- **time** – timestamp of the current value, +- **value** – the current value, +- **prevValue** – value returned by the previous function call, +- **timePrev** – timestamp of the previous value, +- **prevOrigValue** – original previous value. + +The function must **return** a value (**number**|**string**|**boolean**|**null**). +Returning **null** excludes the data point from visualization. {% include images-gallery.html imageCollection="data-key-configuration-settings-post-processing" %} From 30cf891611e099d1bf564a78f7a02bbe2648d76a Mon Sep 17 00:00:00 2001 From: Oleg Khalkov Date: Wed, 5 Nov 2025 16:24:31 +0200 Subject: [PATCH 2/2] Improve docs Entity groups (permissions, share, public-private) rephrase step for data post processing Affects: /docs/pe/user-guide/groups/ --- _includes/docs/user-guide/widgets.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_includes/docs/user-guide/widgets.md b/_includes/docs/user-guide/widgets.md index be635d5cc5..44d95da436 100644 --- a/_includes/docs/user-guide/widgets.md +++ b/_includes/docs/user-guide/widgets.md @@ -311,7 +311,7 @@ in widgets. This feature allows you to apply custom JavaScript logic to each dat filter out anomalies, or calculate derived metrics without touching upstream sources. **How to use:** - - In the widget → go to **Series** section → click the **Pencil** icon next to the data key. + - In the widget → go to section with **Data keys** → click the **Pencil** icon of the target data key. - Enable toggle **Use data post-processing function**. - Enter your code in the function body. The platform automatically injects the function header:
**function** (time, value, prevValue, timePrev, prevOrigValue) {