Flexmonster Software License Agreement (“Agreement”) has been revised and is effective as of January 8, 2025.
The following modifications were made:
The modified version of Agreement is available here.
Downloading, installing, and/or continuing to use Flexmonster Software after January 8, 2025, constitutes Licensee’s acceptance of the terms and conditions of the modified version of Agreement. If Licensee does not agree to any of these terms and conditions, they must cease using Flexmonster Software and must not download, install, use, access, or continue to access Flexmonster Software. By continuing to use Flexmonster Software or renewing the license or maintenance after the effective date of these modifications to Agreement, Licensee accepts and agrees to be bound by the terms and conditions of the modified Agreement.
To use aggregations in the custom data source API, you need to do the following:
This guide covers both steps and provides additional information about aggregations in the custom data source API.
The aggregations supported by Flexmonster for the custom data source API are the following:
You must implement all necessary aggregations manually.
Note For the fields of the "number"
type, built-in front-end aggregations are available. You do not need to implement them on the server.
Available aggregations are defined in the response to the /fields request. You can define aggregations for all fields, for fields of a certain type, or for a specific field.
Specify an array of the necessary aggregations in the aggregations property:
{
"aggregations": ["count", "distinctcount"],
}
Aggregations for the "string"
, "number"
, and "date"
field types can be configured using the aggregations.string, aggregations.number, and aggregations.date properties respectively. These configurations override the ones set for all fields in aggregations
.
We will showcase the configuration on an example of the "number"
field type:
"aggregations": {
"number": ["count", "distinctcount", "min", "max"],
}
Aggregations for the "string"
and "date"
field types can be defined in the same way.
Note You can use aggregations.any to configure available aggregations for multiple field types:
"aggregations": {
"any": ["count", "distinctcount"],
"date": ["min", "max"],
}
As a result, the aggregations specified in aggregations.any
can be applied to both "number"
and "string"
field types, while fields of the "date"
type will have "min"
and "max"
aggregations available.
To configure aggregations for a specific field, specify the aggregations property for the necessary field in the response to the /fields request. Aggregation configurations for a specific field override configurations set for all fields and for fields of a certain type.
Here is an example of how to configure aggregations for the "Price"
field:
{
"fields": [
{
"uniqueName": "Price",
"aggregations": ["min", "max"],
// Other properties
},
// Other fields
],
"aggregations": ["sum", "average"],
// Other properties
}
As a result, the "Price"
field can be aggregated only with "min"
, "max"
, and built-in front-end aggregations.
After you configure the aggregations on your server, they can be applied to fields in Flexmonster Pivot.
When an aggregation is applied to a specific field, the aggregation is sent in the func property of the query.aggs.values
array in the /select requests for the pivot table and the flat table. Ensure that the server aggregates the data according to the given function.
Besides aggregations supported by Flexmonster, you can implement a custom aggregation on your server:
Step 1. Define the custom aggregation (e.g., "squareroot"
) in the response to the /fields request. The custom aggregation can be defined for all fields, for fields of a certain type, or for a specific field.
See an example:
{
"aggregations": {
"number": ["sum", "average", "squareroot"],
// ...
}
}
Step 2. Implement a function that aggregates data according to your aggregation.
Now the custom aggregation can be used on the client side. In the component, a measure with the custom aggregation will look similar to the following: Price (squareroot)
.
For the custom data source API, Flexmonster supports the following built-in front-end aggregations for the fields of the "number"
type:
Built-in front-end aggregations will appear in Flexmonster Pivot automatically if the "sum"
aggregation is implemented on the back end.
On the client side, you can configure aggregations available for a specific field using the mapping. The list of aggregations can contain both the aggregations supported on the back end (including custom ones) and the built-in front-end aggregations.