Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

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

...

Table of Contents

You will also learn how to use an internal variable, _pipeName.

In this exercise you will produce a single list of updates to customers' Cable TV packages. Customers can update their packages both through the Customer Care a customer care system and in shops. You will bring all these updates together into a single list.

...

Read in data sets from files

  • Create a new model with Name: Channel Package Check

There are two files containing For this exercise you need two files from the zip file you downloaded in  2 Using Excel Templates, step 5. The files contain updates from the two sources (Customer Care, and Shop).
Customer Care updates
A file containing details of customer care updated can be found in the input files, at:
: the customer care service and the shop.

...

  • <path>\train\inputData\ChannelPackages\CustomerCareUpdates\CustomerCareUpdates.txt

...

  • <path>\train\inputData\ChannelPackages\ShopUpdates\ShopUpdates.txt

...

  • Add a File Collector to your model
  • Call this: Customer Care Updates
  • Navigate to the directory …
  1. Create a new model with the Name Channel Package Check.
  2. Add a file collector to your model and load the data:
    1. From the model toolbar, drag a 
      Insert excerpt
      _file_collector
      _file_collector
      nopaneltrue
       into the model.
    2. PhixFlow displays the settings tab for the new file collector. Set the Name to Customer Care Updates.
    3. In the model, hover your mouse pointer over the Channel Package Check file collector to display the context toolbar and click 
      Insert excerpt
      _upload_file
      _upload_file
      nopaneltrue
      .
    4.  Navigate to the directory <path>\train\inputData\ChannelPackages\CustomerCareUpdates.
    5. Select the file CustomerCareUpdates.txt

...

    1. , click Open, then click
      Insert excerpt
      _upload_button
      _upload_button
      nopaneltrue
      .
    2. PhixFlow adds a new stream to the model, called CustomerCareUpdate.
    3. In the model, hover over the new CustomerCareUpdates stream and click  
      Insert excerpt
      _run_analysis
      _run_analysis
      nopaneltrue
    4. Check the data is loaded. There should be 8 lines of data, with columns for Customer Ref, Sales Date and Package.
    5. Now the data is loaded into the stream, set the stream to 
      Insert excerpt
      _static
      _static
      nopaneltrue
       .
  1. Add another file collector to your model and repeat the process described in step 2. This time:
    1. Set the file collector Name to Shop Updates.
    2. Upload <path>\train\inputData\ChannelPackages\ShopUpdates

...

    1. \ShopUpdates.txt

...

    1. .
    2. PhixFlow loads 7 rows of data to this stream.
    3. Remember to set the steam to 
      Insert excerpt
      _static
      _static
      nopaneltrue
      .

Snapshot of the Channel Package Check model so far:

Image Added

Combine the data sets

  1. Create a new

...

  1. stream in your model

...

  1. and populate its attributes.
    1. Hover over CustomerCareUpdates and

...

    1. click 
      Insert excerpt
      _stream_add
      _stream_add
      nopaneltrue
    2. In the settings, set the Name to  Combined Updates.
    3. In the model, show the stream attributes for CustomerCareUpdates .
    4. Select all the attributes and drag them into the properties for the Combined Updates stream. Drop them into the Attributes section.
    5. Click 
      Insert excerpt
      _finish
      _finish
      nopaneltrue
      .
  1. To save your model, in the model toolbar click 
    Insert excerpt
    _save
    _save
    nopaneltrue
  2. Connect the ShopUpdates stream to the Combined Updates stream.
    1. Hover over ShopUpdates and click 
      Insert excerpt
      _pipe
      _pipe
      nopaneltrue
      .
    2. Click Combined Updates to link the pipe to the

...

    1. stream.

      Info

      When you connect streams, PhixFlow automatically adds a reference to the input pipe name. This appears in the attribute expression. To merge this data successfully,  you must update the attribute expressions to remove the in. prefix; see step 4 below.


  1. Fix all the attribute expressions.
    1. Double-click on Combined Updates to open

...

  • Update the expression
Code Block
in.CustomerRef

to

Code Block
CustomerRef

 

  • Press Image Removed in the main Stream configuration form
  • Run Analysis on Combined Updates
  • Check that you have the correct number of records in this Stream when the Analysis is complete
  • Check the data set you generated – make sure that every field in every output record has been populated

...

    1. its settings tab. For each attribute:
    2. In the Attributes section, double-click on an attribute to open its settings.
    3. In the Basic Settings section, edit the Expression to remove in. and click 
      Insert excerpt
      _finish
      _finish
      nopaneltrue

      Image Added
  1. In the Combined Updates stream settings tab, click 
    Insert excerpt
    _finish
    _finish
    nopaneltrue
     to save and close.
  2. In the model, hover your mouse pointer over Combined Updates and click 
    Insert excerpt
    _run_analysis
    _run_analysis
    nopaneltrue
    .
  3. When the stream has run, check that the stream has:
    • the columns CustomerRef, Sales Date and Package
    • 15 rows
    • all cells have data.
      The stream default view:
      Image Added

Snapshot of the Chanel Package Check model so far:

Image Added

Record the source for each update

You will now update you configuration your settings to record the source for each update, in the set of combined updates. To do this:

...

  1. To update the name of the pipe from the

...

  1. CustomerCareUpdates stream to the Combined Updates stream:

      ...

        1. In the model, click on the pipe to open

      ...

        1. its settings tab.
        2. Set Name to CC.
        3. Click 
          Insert excerpt
          _finish
          _finish
          nopaneltrue
           to save and close the pipe settings.
      1. Update the name of the pipe from the ShopUpdates

      ...

      1.  file collector to the ShopUpdates stream.
        1. In the model, click on the pipe to open its settings tab.
        2. Set Name to shop
        3. Click 
          Insert excerpt
          _finish
          _finish
          nopaneltrue
           to save and close pipe settings.
      2. Double-click the

      ...

      1. stream Combined Updates to open

      ...

      1. its settings tab.
      2. In the Attributes section, click
        Insert excerpt
        _add
        _add
        nopaneltrue
         add a new attribute and set:
        1.  NameSource.
        2. Expression:

          Code Block
          if (_pipeName == "CC",
           "Customer Care"
           ,
           "Shop"
           )

      ...


        1. Click 
          Insert excerpt
          _finish
          _finish
          nopaneltrue
           to save and close the attribute settings.
      1. To make Source the first

      ...

      1. attribute in the

      ...

      1. stream, drag it to the top of the

      ...

      1. attributes list.
      2. Click 
        Insert excerpt
        _finish
        _finish
        nopaneltrue
         to save and close the stream settings.
      3. Run analysis on Combined Updates.
      4. Check the output data set and make sure that the source has been recorded on each record correctly.
        Image Added