Join Object Members for SuiteAnalytics in NetSuite

Join object members in SuiteAnalytics encapsulate joined records, enabling complex data retrieval across multiple record types.

·2 min read·View Oracle Docs

Joining records in SuiteAnalytics allows developers to create complex datasets by leveraging the relationships between various record types. This article details the members of the Join object used in datasets, providing essential details for effective implementation.

What Are Join Object Members?

The Join object encapsulates a joined record that is used within a dataset. Each join can pull data across various record types, which is vital for generating comprehensive reports and insights.

Join Object Members Overview

Here are the key members of the dataset.Join object:

Member NameReturn Type / Value TypeSupported Script TypesDescription
Join.fieldIdstring (read-only)Server scriptsThe ID of the field on which the join is performed.
Join.joindataset.Join (read-only)Server scriptsThe child join, if applicable in a multilevel join.
Join.sourcestring (read-only)Server scriptsThe internal ID for the source record type of the join.
Join.targetstring (read-only)Server scriptsThe polymorphic target of the join.

Creating Joins in SuiteAnalytics

To utilize the Join object, you must first create a join using the dataset.createJoin(options) method. Here are some examples of how to create various types of joins:

Basic Join Creation

suitescript
// Create a basic Join
var myNameJoin = dataset.createJoin({
fieldId: 'name'
});

Inverse Join Creation

suitescript
// Create an inverse Join
var myInverseJoin = dataset.createJoin({
fieldId: 'phone',
source: 'contact'
});

Polymorphic Join Creation

suitescript
// Create a polymorphic Join
var myPolymorphicJoin = dataset.createJoin({
fieldId: 'phone',
target: 'entity'
});

Multi-level Join Creation

suitescript
// Create a multi-level Join
var myMultiLevelJoin = dataset.createJoin({
fieldId: 'phone',
join: myNameJoin
});

Loading and Auditing the Joined Dataset

You can load a dataset that includes a join and inspect its properties through logging:

suitescript
1var myDataset = dataset.load({
2 id: myDatasetId // Replace with a valid ID value for your account
3});
4var myJoin = myDataset.columns[0].join;
5
6log.audit({
7 title: 'Join fieldId = ',
8 details: myJoin.fieldId
9});
10log.audit({
11 title: 'Join source = ',
12 details: myJoin.source
13});
14log.audit({
15 title: 'Join target = ',
16 details: myJoin.target
17});
18log.audit({
19 title: 'Join join = ',
20 details: myJoin.join
21});

Conclusion

Using join operations effectively in SuiteAnalytics allows access to a broader range of data, enabling deeper insights and better reporting capabilities.

Source: This article is based on Oracle's official NetSuite documentation.

Key Takeaways

  • The Join object encapsulates complex data relationships within datasets.
  • It supports various join types, including basic, polymorphic, and multi-level joins.
  • Understanding join properties is essential for effective data retrieval and reporting.

Frequently Asked Questions (4)

How do you create a polymorphic join in SuiteAnalytics?
To create a polymorphic join, use the `dataset.createJoin()` method with the `fieldId` specifying the field and the `target` specifying the polymorphic join target. An example is: `var myPolymorphicJoin = dataset.createJoin({fieldId: 'phone', target: 'entity'});`.
Can multi-level joins include multiple child joins in SuiteAnalytics?
Yes, multi-level joins can include multiple child joins by using the `join` property. This creates a hierarchical structure where each `dataset.Join` can further be joined with additional joins.
What is the purpose of the `Join.source` member in SuiteAnalytics?
The `Join.source` member is used to specify the internal ID for the source record type of the join. This helps define from which record type the join is originating.
Is it possible to audit properties of a joined dataset in SuiteScript?
Yes, you can audit properties of a joined dataset by loading the dataset using `dataset.load()` and then logging the properties of interest using SuiteScript's `log.audit()` for fields like `fieldId`, `source`, `target`, and `join`.
Source: Join Object Members Oracle NetSuite Help Center. This article was generated from official Oracle documentation and enriched with additional context and best practices.

Was this article helpful?

More in General

View all General articles →