Child pages
  • QBJoins

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
DO NOT EDIT THE CONTENT OF THIS PAGE DIRECTLY (EXCEPT INSIDE THE DIV BELOW WITH ID=DESCRIPTION), UNLESS YOU KNOW WHAT YOU'RE DOING.
THE STRUCTURE OF THE CONTENT IS VITAL IN BEING ABLE TO AUTO UPDATE THE CONTENT THROUGH THE DOC GENERATOR.
Enter additional information related to this 'class' inside the {div} macro with 'id=description'
Divcache
styleindexdisplay:none
Div
iddescription
HTML Table
id
classservoy sSummary
Colgroup Tag
Col
width80px
Col
Table Head (thead)
Table Row (tr)
styleheight: 30px;
Table Head (th)
colspan2
Property Summary
Table Row (tr)
Table Cell (td)
QBTableClause
Table Cell (td)parent
true
refresh100d
showRefreshtrue
iddoc
titleRefresh page
showDatetrue
retryEnable

servoy sReturnTypes2100%height: 30px;2Supported ClientssWordListSmartClientsWordListWebClientsWordListNGClient

servoy sSummary12%30%58%height: 30px;3Property SummaryGet query builder parent table clause, this may be a query or a join clause. Table Row (tr)

Table Cell (td)
QBSelect
Table Cell (td)root
Get query builder parent.

HTML Table

idclassservoy sSummary

Colgroup Tag
Col
width80px
Col
Table Head (thead) Table Row (tr)styleservoy sSummary12%30%58%height: 30px;
Table Head (th)
colspan2
Method Summary
Table Row (tr)
Table Cell (td)
QBJoin
Table Cell (td)add(dataSource)
Table Row (tr)
Table Cell (td)
QBJoin
Table Cell (td)add(dataSource, joinType)
3Methods SummaryAdd a join clause from the parent query builder part to a derived table based on another query.Add a join clause from the parent query builder part to a derived table based on another query.Add a join with join type IQueryBuilderJoin#LEFT_OUTER_JOIN and no alias for the joining table.Add a join with no alias for the joining table. Table Row (tr)
Table Cell (td)
QBJoin
Table Cell (td)add(dataSource, joinType, alias)
Table Row (tr)
Table Cell (td)
QBJoin
Table Cell (td)add(dataSourceOrRelation, alias)
Add a join clause from the parent query builder part to the specified data source.Add a join based on relation or add a manual join.
HTML Table
idproperty
classservoy sDetail
Colgroup Tag
Col
colspan2
width100%
Col
Table Head (thead)
Table Row (tr)
styleheight: 30px;
Table Head (th)
colspan2
Property Details
Table Body (tbody)
idparent
Table Row (tr)
idname
Table Cell (td)

parent

Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Get query builder parent table clause, this may be a query or a join clause.
Table Row (tr)
idret
Table Cell (td)

Returns

Div
classsIndent
QBTableClause
Table Row (tr)
idsam
Table Cell (td)

Sample

Div
classsIndent
Code Block
languagejavascript
/** @type {QBSelect<db:/example_data/person>} */
	var query = databaseManager.createSelect('db:/example_data/person')
	query.where.add(query.joins.person_to_parent.joins.person_to_parent.columns.name.eq('john'))
	foundset.loadRecords(query)
Table Row (tr)
classlastDetailRow
Table Cell (td)
 
Table Body (tbody)
idroot
Table Row (tr)
idname
Table Cell (td)

root

Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Get query builder parent.
Table Row (tr)
idret
Table Cell (td)

Returns

Div
classsIndent
QBSelect
Table Row (tr)
idsam
Table Cell (td)

Sample

Div
classsIndent
Code Block
languagejavascript
/** @type {QBSelect<db:/example_data/order_details>} */
	var subquery = databaseManager.createSelect('db:/example_data/order_details')

 /** @type {QBSelect<db:/example_data/orders>} */
	var query = databaseManager.createSelect('db:/example_data/orders')
	query.where.add(query
		.or
			.add(query.columns.order_id.not.isin([1, 2, 3]))

			.add(query.exists(
					subquery.where.add(subquery.columns.orderid.eq(query.columns.order_id)).root
			))
		)

	foundset.loadRecords(query)
Table Row (tr)
classlastDetailRow
Table Cell (td)
 
HTML Table
idfunction
classservoy sDetail
Colgroup Tag
Col
colspan2
width100%
Col
Table Head (thead)
Table Row (tr)
styleheight: 30px;
Table Head (th)
colspan2
Method Details
Table Body (tbody)
idadd-String
Table Row (tr)
idname
Table Cell (td)

add

Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
QBJoin
Span
stylefont-weight: bold;
add
Span
(dataSource)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Add a join with join type IQueryBuilderJoin#LEFT_OUTER_JOIN and no alias for the joining table.
Table Row (tr)
idprs
Table Cell (td)

Parameters

Div
classsIndent
{String} dataSource - data source
Table Row (tr)
idret
Table Cell (td)

Returns

Div
classsIndent
QBJoin
Table Row (tr)
idsam
Table Cell (td)

Sample

Div
classsIndent
Code Block
languagejavascript
/** @type {QBSelect<db:/example_data/orders>} */
	var query = databaseManager.createSelect('db:/example_data/orders')
 /** @type {QBJoin<db:/example_data/order_details>} */
	var join = query.joins.add('db:/example_data/order_details', JSRelation.INNER_JOIN, 'odetail')
	join.on.add(join.columns.orderid.eq(query.columns.orderid))
 // to add a join based on a relation, use the relation name
 var join2 = query.joins.add('orders_to_customers', 'cust')
	query.where.add(join2.columns.customerid.eq(999))
	foundset.loadRecords(query)
Table Row (tr)
classlastDetailRow
Table Cell (td)
 
Table Body (tbody)
idadd-String_Number
Table Row (tr)
idname
Table Cell (td)

add

Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
QBJoin
Span
stylefont-weight: bold;
add
Span
(dataSource, joinType)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Add a join with no alias for the joining table.
Table Row (tr)
idprs
Table Cell (td)

Parameters

Div
classsIndent
{String} dataSource - data source
{Number} joinType - join type, one of JSRelation.LEFT_OUTER_JOIN, JSRelation.INNER_JOIN, JSRelation.RIGHT_OUTER_JOIN, JSRelation.FULL_JOIN
Table Row (tr)
idret
Table Cell (td)

Returns

Div
classsIndent
QBJoin
Table Row (tr)
idsam
Table Cell (td)

Sample

Div
classsIndent
Code Block
languagejavascript
/** @type {QBSelect<db:/example_data/orders>} */
	var query = databaseManager.createSelect('db:/example_data/orders')
 /** @type {QBJoin<db:/example_data/order_details>} */
	var join = query.joins.add('db:/example_data/order_details', JSRelation.INNER_JOIN, 'odetail')
	join.on.add(join.columns.orderid.eq(query.columns.orderid))
 // to add a join based on a relation, use the relation name
 var join2 = query.joins.add('orders_to_customers', 'cust')
	query.where.add(join2.columns.customerid.eq(999))
	foundset.loadRecords(query)
Table Row (tr)
classlastDetailRow
Table Cell (td)
 
Table Body (tbody)
idadd-String_Number_String
Table Row (tr)
idname
Table Cell (td)

add

Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
QBJoin
Span
stylefont-weight: bold;
add
Span
(dataSource, joinType, alias)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Add a join clause from the parent query builder part to the specified data source.
Table Row (tr)
idprs
Table Cell (td)

Parameters

Div
classsIndent
{String} dataSource - data source
{Number} joinType - Remove the joins that are not used anywhere in the query.

propertyservoy sDetail2100%height:30px2Property Detailsparentname

parent

dessIndent
Get query builder parent table clause, this may be a query or a join clause.
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRowrootname

root

dessIndent
Get query builder parent.
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow

functionservoy sDetail2100%height:30px2Methods Detailsaddname

add(subqueryBuilder, joinType)

dessIndent
Add a join clause from the parent query builder part to a derived table based on another query.
prs

Parameters

sIndentsubqueryBuilder ;joinType ;
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRowaddname

add(subqueryBuilder, joinType, alias)

dessIndent
Add a join clause from the parent query builder part to a derived table based on another query.
prs

Parameters

sIndentsubqueryBuilder ;joinType ;alias ;
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
addname

add(dataSource)

dessIndent
Add a join with join type IQueryBuilderJoin#LEFT_OUTER_JOIN and no alias for the joining table.
prs

Parameters

sIndentdataSourcedata source
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
addname

add(dataSource, joinType)

dessIndent
Add a join with no alias for the joining table.
prs

Parameters

sIndentdataSourcedata sourcejoinTypejoin type, one of QBJoin.LEFT_OUTER_JOIN, QBJoin.INNER_JOIN, QBJoin.RIGHT_OUTER_JOIN, QBJoin.FULL_JOIN
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
addname

add(dataSource, joinType, alias)

dessIndent
Add a join clause from the parent query builder part to the specified data source.
prs

Parameters

sIndentdataSourcedata sourcejoinTypejoin type, one of IQueryBuilderJoin#LEFT_OUTER_JOIN, IQueryBuilderJoin#INNER_JOIN, IQueryBuilderJoin#RIGHT_OUTER_JOIN, IQueryBuilderJoin#FULL_JOIN

{String} alias - Table Row (tr)idthe alias for joining tableret

Table Cell (td)

Returns

divsIndentclients

classid

Supported Clients

sIndent
QBJoin Table Row (tr)SmartClient,WebClient,NGClientsam

Table Cell (td)

Table Row (tr)
classlastDetailRow
Table Cell (td)
 
Table Body (tbody)
idadd-String_String
Table Row (tr)
idname
Table Cell (td)

add

Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
QBJoin
Span
stylefont-weight: bold;
add
Span

Sample

Div
classsIndent
Code Block
languagejavascript
/** @type {QBSelect<db:/example_data/orders>} */
	var query = databaseManager.createSelect('db:/example_data/orders')
 /** @type {QBJoin<db:/example_data/order_details>} */
	var join = query.joins.add('db:/example_data/order_details', JSRelation.INNER_JOIN, 'odetail')
	join.on.add(join.columns.orderid.eq(query.columns.orderid))
 // to add a join based on a relation, use the relation name
 var join2 = query.joins.add('orders_to_customers', 'cust')
	query.where.add(join2.columns.customerid.eq(999))
	foundset.loadRecords(query)
idsIdentjavascriptlastDetailRowaddname

add(dataSourceOrRelation, alias)

Table Row (tr)classdes Table Cell (td) DivsIndent
Add a join based on relation or add a manual join.


When dataSourceOrRelation is a relation name, a join will be added based on the relation.

id

When dataSourceOrRelation is a data source, an empty join will be added with join type IQueryBuilderJoin#LEFT_OUTER_JOIN.
Table Row (tr)prs

Table Cell (td)class

Parameters

DivsIndent{String} dataSourceOrRelation - data source
{String} alias - Table Row (tr)idthe alias for joining tabletdret

Returns

divsIndentclients

class Table Row (tr)

classlastDetailRow
Table Cell (td) 

Supported Clients

sIndent
QBJoin
Table Row (tr)
idsam
Table Cell (td)

Sample

Div
classsIndent
Code Block
languagejavascript
/** @type {QBSelect<db:/example_data/orders>} */
	var query = databaseManager.createSelect('db:/example_data/orders')
 /** @type {QBJoin<db:/example_data/order_details>} */
	var join = query.joins.add('db:/example_data/order_details', JSRelation.INNER_JOIN, 'odetail')
	join.on.add(join.columns.orderid.eq(query.columns.orderid))
 // to add a join based on a relation, use the relation name
 var join2 = query.joins.add('orders_to_customers', 'cust')
	query.where.add(join2.columns.customerid.eq(999))
	foundset.loadRecords(query)
SmartClient,WebClient,NGClientsam

Sample

sIdentjavascript
lastDetailRow
getJoinsname

getJoins()

dessIndentret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
removeUnusedname

removeUnused(keepInnerjoins)

dessIndent
Remove the joins that are not used anywhere in the query.
prs

Parameters

sIndentkeepInnerjoinswhen true inner joins are not removed, inner joins may impact the query result, even when not used
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow