Modules

filter

 

Objects/Functions

module (N/query)

SuiteScript 2.0

Component.joinFrom(options)

{Component}.joinFrom({fieldId: {string*},source: {string*}})

N/query Module
Component.joinFrom()
Method Description: Creates an explicit directional join relationship from another component to this 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 explicit directional joins from other components to this component. 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.0 Script Types.
Governance: None
Module: N/query Module
Parent Object: query.Component
Sibling Object Members: Component Object Members
Since: 2018.2
Search NetSuite - https://system.netsuite.com/app/help/helpcenter.nl?search=Component.joinFrom(options)

Example:

// Code Example 1
// Add additional code
//...
var myEmployeeQuery = query.create({
type: query.Type.EMPLOYEE
});

var mySalesOrderJoin = myEmployeeQuery.joinFrom({
fieldId: 'salesrep',
source: 'salesorder'
});

var items = mySalesOrderJoin.autoJoin({
fieldId: 'item'
});

myEmployeeQuery.columns = [
myEmployeeQuery.createColumn({
fieldId: 'entityid'
}),
myEmployeeQuery.createColumn({
fieldId: 'hiredate'
}),
mySalesOrderJoin.createColumn({
fieldId: 'id'
}),
mySalesOrderJoin.createColumn({
fieldId: 'trandate'
})
];

var firstSort = myEmployeeQuery.createSort({
column: myEmployeeQuery.columns[0],
ascending: false
});
var secondSort = myEmployeeQuery.createSort({
column: myEmployeeQuery.columns[1],
ascending: true
});
myEmployeeQuery.sort = [firstSort, secondSort];

var results = myEmployeeQuery.run();
//...
// Add additional code

//SOURCE: https://system.netsuite.com/app/help/helpcenter.nl?fid=section_1530818705.html