Table of Contents
Category: Transform / Advanced
This action merges two tables based on whether a value in one table falls into a range specified by two values in another table.
The lower boundary of a range is inclusive, the upper is exclusive. Ranges can overlap. In such cases, one row for each match will be inserted into the resulting table.
Interval merge can be used to to categorize or "bucket" values in a dataset that fall within a given range or scale, such as survey responses (1-3 = "bad", 4-6 = "neutral", 7-10 = "good"), temperature ranges, size scales, etc.
This action is a good substitute for a Lookup action that uses multiple lookup values with similar return values (e.g., 1="good", 2="good", 3="neutral", 4="bad", 5="bad).
|Merge table||Select the table to merge with the current dataset.|
|Columns||Select whether to merge all columns in the second dataset, or just selected columns. Options: All columns or
Selected columns (choose which columns to include in the merge).
The reference to the second table will appear as a dotted line connecting this action to the second dataset in the application window.
To create a lookup set that doesn't contain any "gaps" be sure to set the "less than" value one higher than the last value you want to be included in the range, and start the following pairing with that same value.
|0||4||Range is 0 to 3|
|4||8||Range is 4 to 7 (don't start with "5" or you'll lose "4")|
|8||11||Range is 8 to 10. (range end is "10" as "11" is excluded)|
A lookup pair (low, high) cannot have a "high" value that is equal to the "low" value. This pairing will not return a match as there is no upper threshold. e.g. with "1" as the low value and "1" (exclusive) as the high value, no actual upper threshold has been defined.
Interval merge can also use text-based lookup ranges and values (see Example 2, below).
Example 1: Find what it feels like in Toronto during the year.
Table 1: Temperature in Toronto (Celsius)
|Month||Temp High (C)|
Table 2: Boundaries
Table to merge is "Table 2"
Values in column (Table 1) is "Temp High (C)"
Are greater than or equal to "Lower" (in Table 2)
And less than "Upper" (in Table 2)
Example 2: Use a letter-based merge to assign Names to letter ranges.
Table 1: Names
Table 2: Lookup ranges
The high value of "Zz" is used in the last record since the low value cannot be the
same as the high value. See Remarks, above.
Table to merge is "Table 2"
Values in column "Name" (Table 1)
Are greater or equal to "Low" (Table 2)
And less than "High" (Table 2)
Columns to merge is "Label"
- Example of using Interval Merge (Project; Module: Main; Group: Tab 1; Table: Table 1; Action position: 2)
- Assign value from conditions based on a table (Project; Module: Main; Group: Group 1; Table: Result; Action position: 2)