Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 8 Next »

By the end of this chapter you will be able to:

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 into a stream. Your model will then have the full list of channels available in each package.

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 
    Error rendering macro 'excerpt-include' : No link could be created for '_show_tables'.
    . 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 
    Error rendering macro 'excerpt-include' : No link could be created for '_create_collector'.
    . PhixFlow adds a new database collector  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 
    Error rendering macro 'excerpt-include' : No link could be created for '_add_stream_with_attributes'.
    . 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.

     How?
    1. Hover your mouse pointer over the SOURCE_PACKAGE_CHANNELS stream , click  Run Analysis 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 
      Error rendering macro 'excerpt-include' : No link could be created for '_show_stream_views'.
      .
    4. In the drop-down list, select 
      Error rendering macro 'excerpt-include' : No link could be created for '_default_view'.
      .  PhixFlow displays the data.

    Snapshot of your model and the data you have loaded:

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 Update stream and click 
    Error rendering macro 'excerpt-include' : No link could be created for '_add_stream'.
    .
  2. In Basic Settings, set the Name to Latest Package All Channels.
  3. Drag all the attributes from Latest Package Update to the settings for Latest Package All Channels.

     How?
    1. Hover your mouse pointer over the stream Latest Package Update.
    2. In the context toolbar, click 
      Error rendering macro 'excerpt-include' : No link could be created for '_stream_attributes'.
      . Phixflow lists the data attributes (column titles) for this stream.
    3. Select all the attributes and drag them into the Latest Package All Channels settings → Attributes section.
  4. Click  Apply and Close to save your changes and close the settings.
  5. Close the attributes list.

Look up 

supplement the Latest Package All Channels stream with additional data from the database, using a lookup pipe.

  1. In the model, add a pipe from SOURCE_PACKAGE_CHANNELS to Latest Package All Channels. PhixFlow opens the settings for the new pipe.
  2. In  Basic Settings section, set:
    • Name: chan
    • Type: Look-up
  3. In the Order/Index section, click 
    Error rendering macro 'excerpt-include' : No link could be created for '_stream_attributes'.
    . PhixFlow opens the list of attributes available from the input stream, in this case PACKAGE and CHANNEL.
  4. Drag PACKAGE into the Order/Index section, then double-click the the new line created. PhixFlow opens the settings for the attribute. Set:
    •  Basic Settings → Index Expression from _out.Package to: in.Package.
      Technical issue: I'm not seeing _out.Package here.
    • Click  Apply and Close to save and close the attribute settings.
  5. Close the attribute list.
  6. In the pipe settings, click  Apply and Close to save your changes and close the settings.


This means that the lookup will match records in the reference data (SOURCE_PACKAGE_CHANNELS) where PACKAGE = Package from the input pipe in
We must do this, rather than using the value of Package from the output because we are using the lookup to drive an output multiplier – and output multipliers are calculated before the output is generated

  • Open the configuration form for the stream Latest Package All Channels by double clicking it
  • In the field Output Multiplier, enter the value: chan.CHANNEL

This means that for each output record processed, PhixFlow will look up the list of channels for the package from the reference stream; it will then work through the list returned, handling each element from the list in turn and generating an output record in the stream for each one

  • Add an attribute to the stream with Name Channel
  • Set the Expression of this attribute to _outputMultiplier

This will print the value of the current element of the output multiplier list to this field

On older models in PhixFlow you may see the internal variable _type. This is the old name for _outputMultiplier. Either can be used, and anywhere you see _type you can update it to _outputMultiplier for clarity.

  • Save your changes
  • Run analysis on the stream Latest Package All Channels
  • Check that your output is a full list of all channels for each customer
  • No labels