Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,18 @@ function onFormLoad(executionContext) {

> **_NOTE:_** If you are using Typescript, you should always use Dataset typings (`IDataset`, `IRecord`...) from `@talxis/client-libraries`. **DO NOT USE** any properties/methods that are not defined in typings. If you do, your scripts might break with any PCF update!

## Aggregations
If the control has active aggregations, it automatically creates a virtual record that contains the aggregated values and pinnes it to the bottom of the dataset. This record is not part of the regular dataset, so you cannot acces it through the `onRecordLoaded` event. In order to access this record instance, you need to retrieve the dataset that was used to create this record. This can be done by registering the `onChildDatasetInitialized` event on the main dataset. Once you have the aggregated dataset instance, you can register events and expressions the same as you would for the main dataset.

```javascript
dataset.addEventListener('onChildDatasetInitialized', (childDataset) => {
childDataset.addEventListener('onRecordLoaded', (record) => {
//register record expressions for the aggregated record
})
})
```
> **_NOTE:_** Due to issues with compatibility, validations are completely disabled for the aggregated record. All other client extensibility features are available, including custom controls, notifications, and conditional formatting.

## Interceptors

Interceptors are a way to intercept certain flows in Dataset and inject your own data.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Virtual Dataset allows you to bind a Dataset Base Control to a field while provi

- **Sorting**
- **Filtering**
- **Aggregations**
- **Paging**
- **Validation**
- **Editing (including linked entities)**
Expand Down Expand Up @@ -314,6 +315,7 @@ In order to provide more features, we have [extended]() the native column interf
| `metadata` | Allows you to define or override [Xrm Attribute Metadata](https://learn.microsoft.com/en-us/power-apps/developer/data-platform/webapi/reference/attributemetadata?view=dataverse-latest) for a column. |
| `oneClickEdit`| Removes the need to double-click a cell to edit its value. Note: Enabling this on too many columns may reduce performance; use only when the performance decrease is acceptable for your use case. |
| `controls ` | Used to set up [cell customizers]().
| `aggregationFunction` | Name of the aggregation function to apply to the column. This aggregation will be automatically applied to the control. |

### Provider specific features

Expand Down Expand Up @@ -353,6 +355,34 @@ There are multiple ways to set the height of the control. By default, the contro
![Control at Full Height](/.attachments/applications/Controls/VirtualDataset/full_height.png)
*Control with Expand to full tab feature on.*

## Column Aggregations

It is possible to set aggregations on columns via the `aggregationFunction` property in the column definition. Depending on the column type and provider, the following aggregation functions are available:

`countcolumn`, `count`, `min`, `max`, `sum`, `avg`

Each provider populates the `SupportedAggregations` array in column metadata to indicate which aggregations a specific column supports. Users can configure aggregations via the UI when the `EnableAggregation` binding is set to `true`. To limit the aggregations available in the UI, set the `SupportedAggregations` property in the column bindings.

```json
{
"name": "amount",
"alias": "amount",
"dataType": "Whole.None",
"displayName": "Amount",
"order": 0,
"visualSizeFactor": 150,
"metadata": {
"SupportedAggregations": ["sum", "avg"]
}
}
```
*Restricting aggregations for `Amount` column to sum and average.*

![Control at Full Height](/.attachments/applications/Controls/VirtualDataset/aggregations.png)
*Control with aggregations set on `Decimal` and `Whole.None` columns.*




## Bindings Summary

Expand Down Expand Up @@ -522,6 +552,15 @@ There are multiple ways to set the height of the control. By default, the contro
<td><code>input</code></td>
<td><code>false</code></td>
</tr>
<tr>
<td>EnableAggregation</td>
<td>Whether the user should be allowed to set aggregations on columns</td>
<td><code>Enum ("Yes" | "No")</code></td>
<td><code>"Yes"</code></td>
<td><code>N/A</code></td>
<td><code>input</code></td>
<td><code>false</code></td>
</tr>

</tbody>
</table>
Expand Down