Child pages
  • QBJoins

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin
{div:style=}
Wiki Markup
Div
styledisplay:none

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



Enter additional information related to this 'class'

inside

the

\

{div}

macro

with

'id=description'

{div} {div:id=description}{div}\\ {table:id=|class=servoy sSummary}{colgroup}{column:width=80px|padding=0px}{column}{column}{column}{colgroup}{tr:style=height: 30px;}{th:colspan=2}Property Summary{th}{tr}{tbody}{tr}{td}[QBTableClause]{td}{td}[#parent] Get query builder parent table clause, this may be a query or a join clause.{td}{tr}{tbody}{tbody}{tr}{td}[QBSelect]{td}{td}[#root] Get query builder parent.{td}{tr}{tbody}{table}\\ {table:id=|class=servoy sSummary}{colgroup}{column:width=80px|padding=0px}{column}{column}{column}{colgroup}{tr:style=height: 30px;}{th:colspan=2}Method Summary{th}{tr}{tbody}{tr}{td}[QBJoin]{td}{td}[#add]\(dataSource) Add a join with join type IQueryBuilderJoin#LEFT\_OUTER\_JOIN and no alias for the joining table.{td}{tr}{tbody}{tbody}{tr}{td}[QBJoin]{td}{td}[#add]\(dataSource, joinType) Add a join with no alias for the joining table.{td}{tr}{tbody}{tbody}{tr}{td}[QBJoin]{td}{td}[#add]\(dataSource, joinType, alias) Add a join clause from the parent query builder part to the specified data source.{td}{tr}{tbody}{tbody}{tr}{td}[QBJoin]{td}{td}[#add]\(dataSourceOrRelation, alias) Add a join based on relation or add a manual join.{td}{tr}{tbody}{table}\\ {table:id=property|class=servoy sDetail}{colgroup}{column:width=100%|padding=0px}{column}{colgroup}{tr:style=height: 30px;}{th:colspan=1}Property Details{th}{tr}{tbody:id=parent}{tr:id=name}{td}h6.parent{td}{tr}{tr:id=des}{td}{div:class=sIndent}Get query builder parent table clause, this may be a query or a join clause.{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[QBTableClause]{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}

Div
iddescription


HTML Table
id
classservoy sSummary
Colgroup Tag
Column
padding0px
width80px

Column

Table Row (tr)
styleheight: 30px;
Table Head (th)
colspan2
Property Summary
Table Body (tbody)
Table Row (tr)
Table Cell (td)
QBTableClause
Table Cell (td)
#parent
Get query builder parent table clause, this may be a query or a join clause.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
QBSelect
Table Cell (td)
#root
Get query builder parent.

HTML Table
id
classservoy sSummary
Colgroup Tag
Column
padding0px
width80px

Column

Table Row (tr)
styleheight: 30px;
Table Head (th)
colspan2
Method Summary
Table Body (tbody)
Table Row (tr)
Table Cell (td)
QBJoin
Table Cell (td)
#add(dataSource)
Add a join with join type IQueryBuilderJoin#LEFT_OUTER_JOIN and no alias for the joining table.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
QBJoin
Table Cell (td)
#add(dataSource, joinType)
Add a join with no alias for the joining table.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
QBJoin
Table Cell (td)
#add(dataSource, joinType, alias)
Add a join clause from the parent query builder part to the specified data source.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
QBJoin
Table Cell (td)
#add(dataSourceOrRelation, alias)
Add a join based on relation or add a manual join.

HTML Table
idproperty
classservoy sDetail
Colgroup Tag
Column
padding0px
width100%

Table Row (tr)
styleheight: 30px;
Table Head (th)
colspan1
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
Column
padding0px
width100%

Table Row (tr)
styleheight: 30px;
Table Head (th)
colspan1
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)
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idadd-String_Number
}{
Table Row (tr)
:
id
=
name
}{td}h6.add{td}{tr}{tr:id=sig}{td}{span:style=
Table Cell (td)
add
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right:
5px;
}[
QBJoin
]{span}{span:style=
Span
stylefont-weight:
bold;
}
add
{span}{span}\
Span
(dataSource,
joinType)
{span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Add a join with no alias for the joining table.{div}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[String]} dataSource -- data source \{[Number]} joinType -- join type, one of JSRelation.LEFT\_OUTER\_JOIN, JSRelation.INNER\_JOIN, JSRelation.RIGHT\_OUTER\_JOIN, JSRelation.FULL\_JOIN {div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[QBJoin]{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
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)
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idadd-String_Number_String
}{
Table Row (tr)
:
id
=
name
}{td}h6.add{td}{tr}{tr:id=sig}{td}{span:style=
Table Cell (td)
add
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right:
5px;
}[
QBJoin
]{span}{span:style=
Span
stylefont-weight:
bold;
}
add
{span}{span}\
Span
(dataSource,
joinType,
alias)
{span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Add a join clause from the parent query builder part to the specified data source.{div}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[String]} dataSource -- data source \{[Number]} joinType -- join type, one of IQueryBuilderJoin#LEFT\_OUTER\_JOIN, IQueryBuilderJoin#INNER\_JOIN, IQueryBuilderJoin#RIGHT\_OUTER\_JOIN, IQueryBuilderJoin#FULL\_JOIN \{[String]} alias -- the alias for joining table {div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[QBJoin]{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
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 – join type, one of IQueryBuilderJoin#LEFT_OUTER_JOIN, IQueryBuilderJoin#INNER_JOIN, IQueryBuilderJoin#RIGHT_OUTER_JOIN, IQueryBuilderJoin#FULL_JOIN
{String} alias – the alias for joining table
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)
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idadd-String_String
}{
Table Row (tr)
:
id
=
name
}{td}h6.add{td}{tr}{tr:id=sig}{td}{span:style=
Table Cell (td)
add
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right:
5px;
}[
QBJoin
]{span}{span:style=
Span
stylefont-weight:
bold;
}
add
{span}{span}\
Span
(dataSourceOrRelation,
alias)
{span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}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. When dataSourceOrRelation is a data source, an empty join will be added with join type IQueryBuilderJoin#LEFT\_OUTER\_JOIN.{div}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[String]} dataSourceOrRelation -- data source \{[String]} alias -- the alias for joining table {div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[QBJoin]{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
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.
When dataSourceOrRelation is a data source, an empty join will be added with join type IQueryBuilderJoin#LEFT_OUTER_JOIN.
Table Row (tr)
idprs
Table Cell (td)
Parameters
Div
classsIndent
{String} dataSourceOrRelation – data source
{String} alias – the alias for joining table
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)
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{table}
Table Row (tr)
classlastDetailRow
Table Cell (td)