Versions Compared

Key

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

Insert excerpt
_Banners
_Banners
nameanalysis
nopaneltrue

Scenario

Combining a large

stream

table with data from a small

stream

table, where the values of the very small

stream

table will be repeated throughout the result. For each pair of matching records from the data sets, a single record is produced in the output.

info

iconfalsetitle

Example

Find the description for each code in a

stream

table of thousands from a

stream

table containing mapping data. There are only ~100 possible codes.

Solution

  1. To do this, use a calculate
stream
  1. table with an order/index lookup pipe.
  2. In the below screenshot, 'Source
Stream
  1. Table 1' about 2000 records and we want to enrich this data with data from 'Source
Stream
  1. Table 2', which contains about 50 records.
  2. The
result stream
  1. result  table type is set to 'Calculate'.
  2. The pipe from 'Source
Stream
  1. Table 1' is a pull pipe with no grouping.
  2. The pipe from 'Source
Stream
  1. Table 2' is a lookup pipe. An Order/Index entry should be added to define the joining key between the 2
streams
  1. tables.
  2. This will index all the records from the source
stream
  1. table 2 by the index attribute, so they can be searched quickly. The data will be queried once and the result put into memory.
  2. All
stream
  1. attributes use the attribute name, prefixed by the pipe name. For example, in1.Attribute1.

Image Removed

You need to make sure that all attributes that you refer to with _out prefixes in the joining key have a lower order number than those that use the lookup pipe prefix. For example, in the above screenshot, it is essential that Attribute1 has a lower order number than Attribute3. If the order of the attributes were switched around, Attribute3 would not return a value, because the order/index would be looking for records where Attribute1 is null, because it would not yet be calculated.

Image Added


Info

Watch out for the multiple records returned by your lookup pipe. You will

either

need to do one of the following:

choose
  • Choose a record in each group
(e.g. contacts.1.ContactName will choose the first record in the group),use
  • using a dot number after your attribute. For example, in_2.Description.1
  • Use an aggregate function to find the best record in the the group (e.g. max(contacts.ContactName),
or tick
  • Tick 'multiplier' on the pipe, which will cause the resulting
stream
  • table to display one row per record in the group, rather than one record for the group.
Further details on look up pipes can be found here: Difference between filter and order/index lookups
  • Place 1 in the Max Number of Records per Group, this will take the first record in the group. Use a non-grouped attribute should you wish to sort the group to control the first record.