Versions Compared

Key

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

Insert excerpt
_Banners
_Banners
nameanalysis
nopaneltrue

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

  • Create lookup pipes
  • Enrich a data set using a lookup pipe

Copy data from merge

...

In your Introduction to Modelling analysis model you will create a new

...

table to copy over all data from your merge table:

  1. Hover over the

...

  1. merge table Customer All Details, and press 

...

  1. Insert excerpt
    _table_new
    _table_new
    nopaneltrue
    .
  2. Call this

...

  1. table: Customer Details with Region.

...

  1. To copy all attributes into your new

...

  1. table, hover over Customer All Details and in the hover menu press 

...

  1. Insert excerpt
    _table_attributes_show
    _table_attributes_show
    nopaneltrue
    1. Select all attributes in the list:
      1. Select the tick box next to Name.
      2. Alternatively, select the top attribute

...

      1. , then keeping shift pressed down

...

      1. , select the bottom attribute in the list.
    1. Drag the attributes on top of the

...

    1. table Customer Details with Region

...

    1. .
  1. Insert excerpt
    _run_analysis
    _run_analysis
    nopaneltrue
     on new Customer Details with Region table and look at the data in it to verify that you have copied the data from the Customer All Details merge

...

  1. table.
  2. Remember to save your model layout.

Here you have copied data from a merge

...

table into a new

...

table – but this method works for any type of input

...

table. Copying data into a new

...

table is a common starting point for a modelling step.

Create a lookup into reference data

Now you will add a lookup pipe from Regions by County to enrich the data in Customer Details with Region, by finding the region for each customer address:

  1. Hover over

...

  1. the table Regions by County and press 
    Insert excerpt
    _pipe
    _pipe
    nopaneltrue
    .
  2. Move the pointer over the top of Customer Details with Region and select – this will attach the end of the pipe to the selected

...

  1. table.
  2. In the pipe

...

  1. settings, enter:

    ...

      • Name: region
      • Type: Look-up
      • Data To Read: leave as the default – Latest

    ...

      • Press 
        Insert excerpt
        _save
        _save
        nopaneltrue
        .
      • In the Order/Index section of the pipe settings we will set up the fields to match across the two

    ...

      • recordsets:
        1. Press 

    ...

        1. Insert excerpt
          _attributes_show
          _attributes_show
          nopaneltrue
          .
        2. Drag the attribute County from the left hand list (the input attributes from the

    ...

        1. table Regions By County) into the list of Order/Index attributes.
        2. Drag the attribute County

    ...

        1.  from the right hand list (the output attributes from the

    ...

        1. table Customer Details with Region) on top of the Order/Index attribute County.

    ...

        1. Image Added
          1. Notice that in the Order/Index section,

    ...

          1. the Index Expression column has updated to _out.County.

    ...

          1. Image Added
          2. This means that the lookup will match records in the reference data (

    ...

          1. Regions By County) where County

    ...

          1. equals County in the output data (Customer Details with Region).
        1. Press 

    ...

        1. Insert excerpt
          _finish
          _finish
          nopaneltrue
           on the pipe settings.
      • Note that the pipe linking

    ...

      • Regions By County to Customer Details with Region

    ...

      •  is dashed; this indicates that this is a lookup pipe.


    Tip

    When adding lookup pipes

    ...

    , the arrow points in the direction that the data flows

    ...

    . Here you are getting data from

    ...

    Regions By County to add to Customer Details with Region.

    Enrich a

    ...

    dataset using a Lookup Pipe

    Now you

    ...

    will add the region

    ...

    from Regions By County to Customer Details with Region:

    1. Hover over

    ...

    1. Regions By County and in the hover menu press 

    ...

    1. Insert excerpt
      _table_attributes_show
      _table_attributes_show
      nopaneltrue
    2. On the list of the

    ...

    1. table attributes, drag the attribute Region

    ...

    1.  from Regions By County on top of the Customer Details with Region table in the model.
    2. Run analysis on Customer Details with Region.

    ...

    1. View the data in

    ...

    1. the table. Check that the Region attribute has been populated with the value looked up from

    ...

    1. Regions By County, like the image below:
      1. Image Added
    2. In the model window, click 
      Insert excerpt
      _save_saveModel
      _save_saveModel
      nopaneltrue
      .