Query.joinFrom(options)
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):
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 |
|
Supported Script Types |
Client and server scripts For more information, see SuiteScript 2.x Script Types. |
Governance |
None |
Module |
|
Parent Object |
|
Sibling Object Members |
|
Since |
2018.2 |
Parameters
The options
parameter is a JavaScript object.
Parameter |
Type |
Required / Optional |
Description |
---|---|---|---|
|
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. |
|
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 |
---|---|
|
The specified join relationship already exists. |
Syntax
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