Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: DOC-74 Updates - expand the database section

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.


  1. In the repository browser, expand the list of Datasources.
  2. Drag the datasource called Rating and Billing into your model.
  3. In your model, hover your mouse pointer over Rating and Billing and click 
    Insert excerpt
    _show_tables
    _show_tables
    nopaneltrue
    . PhixFlow displays a list of the tables available in this database. You can resize the list to make it easier to browse.
  4. Right-click on SOURCE_PACKAGE_CHANNELS and select 
    Insert excerpt
    _create_collector
    _create_collector
    nopaneltrue
    . PhixFlow adds a new database collector Image Added to the model, and gives it the same name as the source data table, SOURCE_PACKAGE_CHANNELS. In the settings → Basic Settings section → Statement Expression, you can see the database query is: select * from SOURCE_PACKAGE_CHANNELS.
  5. Hover your mouse pointer over the new database collector, and click 
    Insert excerpt
    _add_stream
    _add_stream
    nopaneltrue
    Check icon??. PhixFlow adds a new stream to your model and also gives it the name SOURCE_PACKAGE_CHANNELS. In the settings → Attributes section, you can see that data has two attributes (columns): Package and Channel.
  6. To load the data into the stream, run analysis on this section of the model and check the data has loaded.

    Expand
    titleHow?
    1. Hover your mouse pointer over the SOURCE_PACKAGE_CHANNELS stream , click 
      Insert excerpt
      _run_analysis
      _run_analysis
      nopaneltrue
       then click YES to confirm.
    2. When PhixFlow notifies you that the analysis is finished, hover your mouse pointer over the stream again.
    3. Click 
      Insert excerpt
      _show_stream_views
      _show_stream_views
      nopaneltrue
      .
    4. In the drop-down list, select 
      Insert excerpt
      _default_view
      _default_view
      nopaneltrue
      .  PhixFlow displays the data.

    Snapshot of your model and the data you have loaded:

    Image Added

Create a stream for full channel list

...

Update your model to add a stream. This stream will hold the full channel list

...

.

  1. Hover your mouse pointer over the Latest Package UpdateGive the new Stream the Name stream and click 
    Insert excerpt
    _add_stream
    _add_stream
    nopaneltrue
     (check icon)??.
  2. In Basic Settings, set the Name to Latest Package All Channels.
  3. Drag all the attributes

    from

    from Latest Package Update to the settings for Latest Package All Channels

    To complete the configuration:

    .

    Expand

    Hover your mouse pointer over the stream Latest Package Update.

    In the context toolbar, click 

    Insert excerpt
    _stream_attributes
    _stream_attributes
    nopaneltrue
    . Phixflow lists the data attributes (column titles) for this stream.

    Select all the attributes and drag them into the Latest Package All Channels settings → Attributes section.


  4. Click 
    Insert excerpt
    _finish
    _finish
    nopaneltrue
     to save the change and close the stream settings and close the attributes list.
  5. Add a lookup pipe from SOURCE_PACKAGE_CHANNELS into Latest Package All Channels
  6. Call the pipe chan
  7. Go to the Order/Index section
  8. Press  - Show Stream Attributes
  9. Drag PACKAGE from the left hand (input) list
  10. Drag Package from the right hand (output) list over the top of the Order/Index attribute PACKAGE
  11. Double click on the Order/Index attribute PACKAGE to edit its details:
  12. Update the Index Expression from _out.Package to: in.Package
  13. Save your changes

...