PhixFlow Help

When to Use an Aggregate Stream

Scenario

You only have one source, but you want to group the data and only pull back aggregated information for each group.

Example

You want to find the earliest entry in a task list.

There are 2 ways to configure an aggregate stream:

The first method is to put an aggregate attribute on the pipe. This is shown in the first screenshot below. When not selected (as it is in the screenshot), a pipe with an aggregate attribute will be displayed in blue.

The pull pipe from the source to the result stream is a pull pipe and has an aggregate attribute on it. You can add a grouping to the pipe if you wish. The stream type of the result stream is 'Aggregate'.

The grouping attributes are referred to in the resulting stream by _key[n], where n is the order number for the grouping.

The aggregate attribute is referred to by the pipename and its name, e.g. in.maxAttribute2.

This is the most efficient way of aggregating data with the aggregate stream. However, you will not be able to refer to any attributes in the source stream for which there is no grouping or aggregate attribute. 

If you need flexibility to refer to attributes that are not in the grouping or aggregate attribute list, then do not add an aggregate attribute. Instead use aggregate functions, such a max(), min(), countElements() and sum() to aggregate fields. You will then be able to look at all un-aggregated attributes and performs functions such as forEach().

The setup for this second approach is shown in the screenshot below.

Please let us know if we could improve this page feedback@phixflow.com