Query.joinFrom(options)

Note:

The content in this help topic pertains to SuiteScript 2.0.

Method Description

Creates an explicit directional join relationship from a child component to its parent component (an inverse join). This method sets the Component.source property on the returned query.Component object.

Use the method query.create(options) to create your initial query definition (query.Query). The initial query definition uses one query type. For available query types, see query.Type.

After you create the initial query definition, use this method to create your first join as an explicit directional join from another component to this component.

Note:

This method is a shortcut for the chained Query.root and Component.joinFrom(options): Query.root.joinFrom(options). The Query.root property references the root component, which is a query.Component object.

Important:

The N/query module supports the same record types that are supported by the SuiteAnalytics Workbook interface. For more information, see Available Record Types.

Returns

query.Component

Supported Script Types

Client and server scripts

For more information, see SuiteScript 2.x Script Types.

Governance

None

Module

N/query Module

Parent Object

query.Query

Sibling Object Members

Query Object Members

Since

2018.2

Parameters

Note:

The options parameter is a JavaScript object.

Parameter

Type

Required / Optional

Description

options.fieldId

string

required

The column type (field type) that joins the parent component to the new component.

Obtain this value from the Records Catalog. The Records Catalog lists every record type and field that is available using SuiteAnalytics Workbook and the N/query module. For more information, see Records Catalog Overview.

options.source

string

required

The query type of the component joined to this component. This value sets the Component.source property.

This value can be described as the inverse relationship of this component, and it determines the source query type of the newly joined component.

Errors

Error Code

Thrown If

RELATIONSHIP_ALREADY_USED

The specified join relationship already exists.

Syntax

Important:

The following code sample shows the syntax for this member. It is not a functional example. For a complete script example, see N/query Module Script Samples.

            // Add additional code
...
var myEmployeeQuery = query.create({ type: query.Type.EMPLOYEE
}); var myTransactionJoin = myEmployeeQuery.joinFrom({ fieldId: 'entity', source: 'transaction'
}); myEmployeeQuery.columns = [ myEmployeeQuery.createColumn({ fieldId: 'entityid' }), myTransactionJoin.createColumn({ fieldId: 'entity' }), myTransactionJoin.createColumn({ fieldId: 'daysoverduesearch' })
];
...
// Add additional code 

          

Related Topics

query.Query
N/query Module
SuiteScript 2.x Modules
SuiteScript 2.x

General Notices