By the end of this chapter you will be able to:
You will also learn how to pass only some records to the receiving stream using the Maximum Number of Records per Group option.
In this exercise you will select the most recent sales record for each customer from the set of combined updates you created in the previous exercise.
...
In PhixFlow, we use an aggregate stream to show that we are rearranging data from a single stream. See the reference page Aggregate Stream for details.
- In From the model toolbar, find drag
Insert excerpt |
---|
| _streamtable_aggregate |
---|
| _streamtable_aggregate |
---|
nopanel | true |
---|
|
and drag it into into the model. - Set the stream Name to
Latest Package Update
. - Add a pipe from
Combined Updates
:- Hover your mouse pointer over the stream
Combined Updates.
- In the context toolbar, click .
- Click the stream
Latest Package Update
to connect the pipe. - PhixFlow opens the pipe settings. Click
Insert excerpt |
---|
| _finish |
---|
| _finish |
---|
nopanel | true |
---|
|
to close the settings.
- Drag all attributes from
Combined Updates
to Latest Package Update
.- Make sure the open settings form is for the stream
Latest Package Update
. - Hover your mouse pointer over the stream
Combined Updates
. - In the context toolbar, click
Insert excerpt |
---|
| _stream_attributes |
---|
| _stream_attributes |
---|
nopanel | true |
---|
|
. Phixflow lists the data attributes (column titles) for this stream. - Select all the attributes and drag them into the
Latest Package Update
settings → Attributes section.
- Click
Insert excerpt |
---|
| _finish |
---|
| _finish |
---|
nopanel | true |
---|
|
to save and close the Latest Package Updates
settings. - Close the attributes pop-up window.
- In the
Channel Package
model toolbar, click .
...
- In the model, double-click on the pipe from the
Combined Updates
stream. - Expand the Sort/Group section toolbar.
- In the section toolbar, click
Insert excerpt |
---|
| _stream_attributes_stream |
---|
| _attributes |
---|
nopanel | true |
---|
|
. Phixflow opens a list of the attributes that the Combined Updates
stream can pass to the pipe.
- Drag in
CustomerRef
. By default, this attribute has Group ticked and Direction set to A-Z (ascending).
This means the data records will be grouped by CustomerRef
. - Drag in
SalesDate
. Double-click on SalesDate
in the Sort/Group grid. PhixFlow opens the settings for the attribute. In Basic Settings, set:- Direction: Z-A (descending)
- Group:
Insert excerpt |
---|
| _check_box_untick |
---|
| _check_box_untick |
---|
nopanel | true |
---|
|
- Click
Insert excerpt |
---|
| _finish |
---|
| _finish |
---|
nopanel | true |
---|
|
to save the change and close the attribute settings.
This means the data records will be sorted by date, with the most recent first.
- In the pipe settings → Sort/Group section, set Maximum Number of Records per Group to 1.
This means PhixFlow will pass only one record, the first and therefore most recent, to the receiving stream.
- Click to save the pipe settings, which should look like this:
- In the model toolbar, click to save the model.
...
- Hover your mouse pointer over the
Latest Package Update
stream and click Insert excerpt |
---|
| _run_analysis |
---|
| _run_analysis |
---|
nopanel | true |
---|
|
then click YES to confirm. - When PhixFlow notifies you that the analysis is finished, hover your mouse pointer over the
Latest Package Update
stream again. - Click
Insert excerpt |
---|
| _view_show |
---|
| _streamview_views_show_stream_views |
---|
nopanel | true |
---|
|
. - In the drop-down list, select
Insert excerpt |
---|
| _view_default |
---|
| _view_default_view |
---|
nopanel | true |
---|
|
. PhixFlow displays the data.
Notice that there is only one record per customer reference. - If you also look at the default view for the
Combined Updates
stream, you will see that some customers, such as C056 have more than one record. The most recent record has been passed to the Latest package Update
stream.
...