Joins
Joins in a dataset let you add fields from record types other than the base record type of the dataset. You can join multiple record types in the same dataset, even record types that are more than one join away from the root record type (called multilevel joining).
For more information about joining record types in SuiteAnalytics Workbook, see Joining Record Types in a Dataset.
To create a join, use dataset.createJoin(options). This method creates a dataset.Join object. You can create a join using the following combinations of parameters:
-
fieldId
– The field to use for the join. This type of join automatically infers the source and target record types for the join based on the record structure.var myJoin = dataset.createJoin({ fieldId: 'email' });
-
fieldId
andjoin
– The field to use and an existing join. This type of join is a multilevel join. Use the join parameter only if a child join exists with the current join as its parent.var myJoin = dataset.createJoin({ fieldId: 'phone', join: myExistingJoin });
-
fieldId
and eithersource
ortarget
– The field to use and the join direction. You may need to use thesource
ortarget
parameters if the source or target records cannot be automatically inferred based on the record structure. For example, use thetarget
parameter if you are joining to a record type that could define multiple inherited record types (such as entity records).var myTargetJoin = dataset.createJoin({ fieldId: 'phone', target: 'entity' });
var mySourceJoin = dataset.createJoin({ fieldId: 'phone', source: 'contact' });