...
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 Collectordatabase collector, using the Datasource datasource
Rating and Billing
, to read all the records from this table - Create a Stream stream from this Database Collectordatabase collector
- Run Analysis analysis on the Stream to read in data from the table into the Stream
...
- stream
Create Stream for full channel list
Add a new Stream stream to your model to hold the full channel list:
- Create a Stream stream using the Add a new Stream button in the tool bar hover menu from
Latest Package Update
- Give the new Stream the Name
Latest Package All Channels
- Drag all attributes from
Latest Package Update
toLatest Package All Channels
To complete the configuration:
- Add a lookup pipe from
SOURCE_PACKAGE_CHANNELS
intoLatest 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 matchGo 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 filed
- from
_out.Package
to:in.Package
- Save your changes
- Call the pipe
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 stream
Latest Package All Channels
by double - clicking itGo to the Advanced tab - 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 Streamstream; it will then work through the list returned, handling each element from the list in turn and generating an output record in the Stream stream for each one
- Add an Attribute attribute to the Stream stream with Name
Channel
- Set the Expression of this Attribute attribute to
_outputMultiplier
This will print the value of the current element from of the Output Multiplier 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. |
- ActioSave Save your changes
- Run Analysis analysis on the Stream stream
Latest Package All Channels
- Check that your output is a full list of all channels for each customer