- Release notes
- Getting started
- Installation
- Configuration
- Integrations
- Authentication
- Working with Apps and Discovery Accelerators
- AppOne menus and dashboards
- AppOne setup
- TemplateOne 1.0.0 menus and dashboards
- TemplateOne 1.0.0 setup
- TemplateOne menus and dashboards
- TemplateOne 2021.4.0 setup
- Purchase to Pay Discovery Accelerator menus and dashboards
- Purchase to Pay Discovery Accelerator Setup
- Order to Cash Discovery Accelerator menus and dashboards
- Order to Cash Discovery Accelerator Setup
- Basic Connector for AppOne
- SAP Connectors
- Introduction to SAP Connector
- SAP input
- Checking the data in the SAP Connector
- Adding process specific tags to the SAP Connector for AppOne
- Adding process specific Due dates to the SAP Connector for AppOne
- Adding automation estimates to the SAP Connector for AppOne
- Adding attributes to the SAP Connector for AppOne
- Adding activities to the SAP Connector for AppOne
- Adding entities to the SAP Connector for AppOne
- SAP Order to Cash Connector for AppOne
- SAP Purchase to Pay Connector for AppOne
- SAP Connector for Purchase to Pay Discovery Accelerator
- SAP Connector for Order-to-Cash Discovery Accelerator
- Superadmin
- Dashboards and charts
- Tables and table items
- Application integrity
- How to ....
- Working with SQL connectors
- Introduction to SQL connectors
- Setting up a SQL connector
- CData Sync extractions
- Running a SQL connector
- Editing transformations
- Releasing a SQL Connector
- Scheduling data extraction
- Structure of transformations
- Using SQL connectors for released apps
- Generating a cache with scripts
- Setting up a local test environment
- Separate development and production environments
- Useful resources
Process Mining
Aggregate expressions
GROUP BY
function in SQL.
An aggregate expression calculates a value for each unique value at the aggregate level. By default, this is on the Root level, i.e. one value for the entire table.
Below is an example of an aggregate expression to calculate the sum of all amounts in the Invoices dataset.
sum(records.amount)
is evaluated as described below:
- Take all records in Invoices.
- For each record, pick the value of the Amount datasource attribute.
- Return the sum of all these amounts.
The expression calculates a single unique value, but this value is added to every record in the dataset. Below is an example of a dataset containing 4 rows.
Instead of calculating an aggregate over the whole dataset, you can also calculate a value over groups of records.
Below is an example of an aggregate expression to calculate the total amount per supplier.
An aggregation level is added, and the scope of the expression is set to this new level. Below is an example dataset.
The aggregate expression is calculated once for each individual value within the scope level. This value is added to each record within this scope. So Total amount is calculated once, then copied 4 times to each record. Total amount per supplier is calculated 3 times. Since there are 2 records with “Supplier A”, its value is set to both records. Since there is only one record for “Supplier B” and “Supplier C” the value is assigned to the corresponding record.
Follow these steps to define an aggregate expression on sub-level.
Step |
Action |
---|---|
1 |
Right-click on Root in the Settings panel in the Edit Expression Attribute dialog. |
2 |
Select Add level. |
3 |
Click on … level and select the datasource attribute on which you want to group values. In this case Supplier. |
4 |
Right click on the selected attribute level and select Set as expression level. |
p
(for parent) and c
(for child) to traverse up and down the tree structure.
p
returns a single node, but can have multiple children, so c
returns a list of nodes.
Below is an example of an aggregate expression based on a parent level.
percentage(sum(records.Amount) / sum(p.records.Amount) * 100)
calculates a percentage for each supplier:
- the sum of the amounts associated with a supplier is divided by the sum of all amounts.
- the scope is shifted to the parent level, i.e. root.
- the result is multiplied by 100 to cast it to a percentage.
Below is an example of an aggregate expression based on a child level.
count(c)
expression returns a list of all suppliers per Supplier type. Since each child is a supplier, the number of children c
can be counted.
if()
function can be used for conditional checks. However, this function can only be applied per record. It is not possible to
check a condition within a group of records using an if-statement. The tree structure can be used to loop over (specific parts
of) your data, for example to express properties.
The following functions can be used for these type of calculations.
Function |
Description |
---|---|
|
Returns
true if at least one Condition in Scope evaluates to true .
|
|
Returns
true if all Conditions in Scope evaluate to true .
|
See illustration below for an example.
For example the expression
exists(records, find(lower(Supplier), 'consulting')
checks for each supplier type if there are invoices from a supplier with ‘consulting’ as part of the name.
lower
is used to convert the supplier names to lower case and make the check case insensitive.
filter()
function can be used.
Below is an example of an aggregate expression based on a filter.
count(
unique(
filter(
records,
supplier_type = "Machinery"
).Supplier
)
)
count(
unique(
filter(
records,
supplier_type = "Machinery"
).Supplier
)
)
From inside outwards, the expression is built up in the following manner:
- Retrieve all records within the current scope.
- Filter these records so only the ones which have a Supplier type of Machinery remain.
- For each filtered record, return the value of the Supplier datasource attribute.
- Remove all duplicate values from the list, so we have only one item per unique value.
-
Count the number of items remaining on the list.
records
is the list of records belonging to this Case owner.
The expression returns a value for each Case owner, which signifies the number of unique Suppliers with the type Machinery.
The menu in the Settings panel contains options to add filtering for aggregates.
Below is a description of the options of the Settings menu.
Option |
Description |
---|---|
Enable filter expression |
Enables you to enter an expression as a filter. |
Enable filter controls |
Opens the Edit Filter Controls dialog where you can select an available filter control from the list. |
Enable compare period |
Enables you to add a compare period or an expression to define a number of previous periods to filter. |
Apply end-user filters |
Enables you to apply available end-user filters. |
Sorting can be used to determine the highest or lowest value or to process records in a certain order.
When you need the first or last record for your expression, you can sort on a level in the following ways:
-
A..Z and Z..A will sort on value.
- On strings, this will sort in alphabetical order.
- On numerical formats (double, integer) this will sort on a numerical value.
- On time-related formats (datetime, date) it will be sorted in chronological order.
- 0..9 and 9..0 will sort on the number of records in the group.
- Expression allows you to fill in an expression, which will be sorted on value as described above.
For each of these sorting options, it is possible to set the order to either ascending or descending.
See the illustration below for an example of sorting where the first user working on each case is determined.
first(records.User)
determines the first User
of each Case ID
. Event end
is sorted in ascending order.