Lookup Transform
Edit this pageThe lookup transform extends a primary data source by looking up values from another data source. It is similar to a one sided join.
// Any View Specification
{
...
"transform": [
{"lookup": ..., "from" ..., "as": ..., "default": ...} // Lookup Transform
...
],
...
}
Lookup Transform
For each data object in the main data source, the transform tries to find a matching objects in the secondary data source. An object matches if the value in the field specified by lookup
is the same as the field specified in the from.key
.
Property | Type | Description |
---|---|---|
lookup | FieldName |
Required. Key in primary data source. |
from | LookupData |
Required. Secondary data reference. |
as | FieldName | FieldName[] |
The field or fields for storing the computed formula value.
If |
default | String |
The default value to use if lookup fails. Default value: |
Lookup Data
The secondary data reference (set with from
) is an object that specifies how the lookup key should be matched to a second data source and what fields should be added.
Property | Type | Description |
---|---|---|
data | Data |
Required. Secondary data source to lookup in. |
key | FieldName |
Required. Key in data to lookup. |
fields | FieldName[] |
Fields in foreign data to lookup. If not specified, the entire object is queried. |
Example
This example uses lookup
to add the properties age
and height
to the main data source. The person
field in the main data source is matched to the name
field in the secondary data source.