By the end of this chapter you will be able to:
Table of Contents |
---|
Use an output multiplier to break out a record into multiple output records
In this exercise you will load reference data into your model which lists all the TV channels offered in each package. You will use this to break out each customer record, in Latest Package Update
, into a set of records for each channel that the customer has ordered.
Load
...
data
...
from a database table
In this section you will load the database table SOURCE_PACKAGE_CHANNELS
gives the into a stream. Your model will then have the full list of channels available in each package.
- Create a database collector, using the datasource
Rating and Billing
, to read all the records from this table - Create a stream from this database collector
- Run analysis on the stream
Tip |
---|
Remember, the Introduction to Modelling course explains about loading data from databases; see section 3 Creating Datasources and Database Collectors. |
- In the repository browser, expand the list of Datasources.
- Drag the datasource called
Rating and Billing
into your model. - In your model, hover your mouse pointer over
Rating and Billing
and click
. PhixFlow displays a list of the tables available in this database. You can resize the list to make it easier to browse.Insert excerpt _show_tables _show_tables nopanel true - Right-click on
SOURCE_PACKAGE_CHANNELS
and select
. PhixFlow adds a new database collector to the model, and gives it the same name as the source data table,Insert excerpt _create_collector _create_collector nopanel true SOURCE_PACKAGE_CHANNELS
. In the settings → Basic Settings section → Statement Expression, you can see the database query is:select * from SOURCE_PACKAGE_CHANNELS
. - Hover your mouse pointer over the new database collector, and click
Check icon??. PhixFlow adds a new stream to your model and also gives it the nameInsert excerpt _add_stream _add_stream nopanel true
. In the settings → Attributes section, you can see that data has two attributes (columns): Package and Channel.SOURCE_PACKAGE_CHANNELS
To load the data into the stream, run analysis on this section of the model and check the data has loaded.
Expand title How? - Hover your mouse pointer over the
SOURCE_PACKAGE_CHANNELS
stream , click
then click YES to confirm.Insert excerpt _run_analysis _run_analysis nopanel true - When PhixFlow notifies you that the analysis is finished, hover your mouse pointer over the stream again.
- Click
.Insert excerpt _show_stream_views _show_stream_views nopanel true - In the drop-down list, select
. PhixFlow displays the data.Insert excerpt _default_view _default_view nopanel true
Snapshot of your model and the data you have loaded:
- Hover your mouse pointer over the
Create a stream for full channel list
...
Update your model to add a stream. This stream will hold the full channel list
...
.
- Hover your mouse pointer over the
Latest Package Update
Give the new Stream the Name stream and click
(check icon)??.Insert excerpt _add_stream _add_stream nopanel true - In Basic Settings, set the Name to
Latest Package All Channels
. Drag all the attributes
fromfrom
To complete the configuration:Latest Package Update
to the settings forLatest Package All Channels
.
Expand Hover your mouse pointer over the stream
Latest Package Update
.In the context toolbar, click
. Phixflow lists the data attributes (column titles) for this stream.Insert excerpt _stream_attributes _stream_attributes nopanel true Select all the attributes and drag them into the
Latest Package All Channels
settings → Attributes section.- Click
to save the change and close the stream settings and close the attributes list.Insert excerpt _finish _finish nopanel true - Add a lookup pipe from
SOURCE_PACKAGE_CHANNELS
intoLatest Package All Channels
- Call the pipe
chan
- Go to the Order/Index section
- Press - Show Stream Attributes
- Drag
PACKAGE
from the left hand (input) list - Drag
Package
from the right hand (output) list over the top of the Order/Index attributePACKAGE
- Double click on the Order/Index attribute
PACKAGE
to edit its details: - Update the Index Expression from
_out.Package
to:in.Package
- Save your changes
...