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

Version 1 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 reference data

The database table SOURCE_PACKAGE_CHANNELS gives the 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 to read in data from the table into the Stream

Create Stream for full channel list

Add a new Stream to your model to hold the full channel list:

  • Create a Stream using the Add a new Stream button in the tool bar from Latest Package Update
  • Give the new Stream the Name Latest Package All Channels
  • Drag all attributes from Latest Package Update to Latest Package All Channels

To complete the configuration:

  • Add a lookup pipe from SOURCE_PACKAGE_CHANNELS into Latest Package All Channels
    • Call the pipe chan
    • In the matching attributes form create a match:
      • Left-hand attribute to PACKAGE
      • Right-hand attribute to Package
    • Update the right-hand matching attribute:
      • Double-click on the match
      • Update the Index Expression filed from _out.Package to: in.Package
    • Save your changes

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
  • Go to the Advanced tab
  • In the field Output Multiplier, enter the value: chan.CHANNEL

This means that for each output record processed, CenterView 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 from the Output Multiplier list to this field

On older models in CenterView 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.

  • ActioSave 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