{div:style=display: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{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}Constants Summary{th}{tr}{tbody}{tr}{td}[Number]{td}{td}[#FULL_JOIN]
Constant for the joinType of a Query Builder join.{td}{tr}{tbody}{tbody}{tr}{td}[Number]{td}{td}[#INNER_JOIN]
Constant for the joinType of a JSRelation.{td}{tr}{tbody}{tbody}{tr}{td}[Number]{td}{td}[#LEFT_OUTER_JOIN]
Constant for the joinType of a JSRelation.{td}{tr}{tbody}{tbody}{tr}{td}[Number]{td}{td}[#RIGHT_OUTER_JOIN]
Constant for the joinType of a Query Builder join.{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}Property Summary{th}{tr}{tbody}{tr}{td}[Boolean]{td}{td}[#allowCreationRelatedRecords]
Flag that tells if related records can be created through this relation.{td}{tr}{tbody}{tbody}{tr}{td}[Boolean]{td}{td}[#allowParentDeleteWhenHavingRelatedRecords]
Flag that tells if the parent record can be deleted while it has related records.{td}{tr}{tbody}{tbody}{tr}{td}[Boolean]{td}{td}[#deleteRelatedRecords]
Flag that tells if related records should be deleted or not when a parent record is deleted.{td}{tr}{tbody}{tbody}{tr}{td}[String]{td}{td}[#foreignDataSource]
Qualified name of the foreign data source.{td}{tr}{tbody}{tbody}{tr}{td}[String]{td}{td}[#initialSort]
A String which specified a set of sort options for the initial sorting of data
retrieved through this relation.{td}{tr}{tbody}{tbody}{tr}{td}[Number]{td}{td}[#joinType]
The join type that is performed between the primary table and the foreign table.{td}{tr}{tbody}{tbody}{tr}{td}[String]{td}{td}[#name]
The name of the relation.{td}{tr}{tbody}{tbody}{tr}{td}[String]{td}{td}[#primaryDataSource]
Qualified name of the primary data source.{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}[JSRelationItem]\[]{td}{td}[#getRelationItems]\()
Returns an array of JSRelationItem objects representing the relation criteria defined for this relation.{td}{tr}{tbody}{tbody}{tr}{td}[UUID]{td}{td}[#getUUID]\()
Returns the UUID of the relation object{td}{tr}{tbody}{tbody}{tr}{td}[JSRelationItem]{td}{td}[#newRelationItem]\(dataprovider, operator, foreinColumnName)
Creates a new relation item for this relation.{td}{tr}{tbody}{tbody}{tr}{td}void{td}{td}[#removeRelationItem]\(primaryDataProviderID, operator, foreignColumnName)
Removes the desired relation item from the specified relation.{td}{tr}{tbody}{table}\\
{table:id=constant|class=servoy sDetail}{colgroup}{column:width=100%|padding=0px}{column}{colgroup}{tr:style=height: 30px;}{th:colspan=1}Constants Details{th}{tr}{tbody:id=FULL_JOIN}{tr:id=name}{td}h6.FULL_JOIN{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[Number]{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
/** @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.RIGHT_OUTER_JOIN, 'odetail')
join.on.add(join.columns.orderid.eq(query.columns.orderid))
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=INNER_JOIN}{tr:id=name}{td}h6.INNER_JOIN{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[Number]{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
var relation = solutionModel.newRelation('parentToChild', 'db:/example_data/parent_table', 'db:/example_data/child_table', JSRelation.INNER_JOIN);
relation.joinType = JSRelation.LEFT_OUTER_JOIN;
/** @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))
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=LEFT_OUTER_JOIN}{tr:id=name}{td}h6.LEFT_OUTER_JOIN{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[Number]{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
var relation = solutionModel.newRelation('parentToChild', 'db:/example_data/parent_table', 'db:/example_data/child_table', JSRelation.INNER_JOIN);
relation.joinType = JSRelation.LEFT_OUTER_JOIN;
/** @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))
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=RIGHT_OUTER_JOIN}{tr:id=name}{td}h6.RIGHT_OUTER_JOIN{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[Number]{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
/** @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.RIGHT_OUTER_JOIN, 'odetail')
join.on.add(join.columns.orderid.eq(query.columns.orderid))
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{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=allowCreationRelatedRecords}{tr:id=name}{td}h6.allowCreationRelatedRecords{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[Boolean]{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
var relation = solutionModel.newRelation('parentToChild', 'db:/example_data/parent_table', 'db:/example_data/child_table', JSRelation.INNER_JOIN);
relation.allowCreationRelatedRecords = true;
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=allowParentDeleteWhenHavingRelatedRecords}{tr:id=name}{td}h6.allowParentDeleteWhenHavingRelatedRecords{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[Boolean]{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
var relation = solutionModel.newRelation('parentToChild', 'db:/example_data/parent_table', 'db:/example_data/child_table', JSRelation.INNER_JOIN);
relation.allowParentDeleteWhenHavingRelatedRecords = false;
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=deleteRelatedRecords}{tr:id=name}{td}h6.deleteRelatedRecords{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[Boolean]{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
var relation = solutionModel.newRelation('parentToChild', 'db:/example_data/parent_table', 'db:/example_data/child_table', JSRelation.INNER_JOIN);
relation.deleteRelatedRecords = true;
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=foreignDataSource}{tr:id=name}{td}h6.foreignDataSource{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[String]{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
var relation = solutionModel.newRelation('parentToChild', 'db:/example_data/parent_table', 'db:/example_data/child_table', JSRelation.INNER_JOIN);
relation.primaryDataSource = 'db:/user_data/another_parent_table';
relation.foreignDataSource = 'db:/user_data/another_child_table';
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=initialSort}{tr:id=name}{td}h6.initialSort{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[String]{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
var relation = solutionModel.newRelation('parentToChild', 'db:/example_data/parent_table', 'db:/example_data/child_table', JSRelation.INNER_JOIN);
relation.initialSort = 'another_child_table_text asc';
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=joinType}{tr:id=name}{td}h6.joinType{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[Number]{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
var relation = solutionModel.newRelation('parentToChild', 'db:/example_data/parent_table', 'db:/example_data/child_table', JSRelation.INNER_JOIN);
relation.joinType = JSRelation.LEFT_OUTER_JOIN;
/** @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))
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=name}{tr:id=name}{td}h6.name{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[String]{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
var relation = solutionModel.newRelation('parentToChild', 'db:/example_data/parent_table', 'db:/example_data/child_table', JSRelation.INNER_JOIN);
relation.name = 'anotherName';
var firstTab = tabs.newTab('firstTab', 'Child Form', childForm, relation);
firstTab.relationName = relation.name;
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=primaryDataSource}{tr:id=name}{td}h6.primaryDataSource{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[String]{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
var relation = solutionModel.newRelation('parentToChild', 'db:/example_data/parent_table', 'db:/example_data/child_table', JSRelation.INNER_JOIN);
relation.primaryDataSource = 'db:/user_data/another_parent_table';
relation.foreignDataSource = 'db:/user_data/another_child_table';
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{table}\\
{table:id=function|class=servoy sDetail}{colgroup}{column:width=100%|padding=0px}{column}{colgroup}{tr:style=height: 30px;}{th:colspan=1}Method Details{th}{tr}{tbody:id=getRelationItems}{tr:id=name}{td}h6.getRelationItems{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[JSRelationItem]\[]{span}{span:style=font-weight: bold;}getRelationItems{span}{span}\(){span}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[JSRelationItem]\[] -- An array of JSRelationItem instances representing the relation criteria of this relation.{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
var criteria = relation.getRelationItems();
for (var i=0; i<criteria.length; i++)
{
var item = criteria[i];
application.output('relation item no. ' + i);
application.output('primary column: ' + item.primaryDataProviderID);
application.output('operator: ' + item.operator);
application.output('foreign column: ' + item.foreignColumnName);
}
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=getUUID}{tr:id=name}{td}h6.getUUID{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[UUID]{span}{span:style=font-weight: bold;}getUUID{span}{span}\(){span}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[UUID]{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
var relation = solutionModel.newRelation('parentToChild', 'db:/example_data/parent_table', 'db:/example_data/child_table', JSRelation.INNER_JOIN);
application.output(relation.getUUID().toString())
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=newRelationItem-String_String_String}{tr:id=name}{td}h6.newRelationItem{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[JSRelationItem]{span}{span:style=font-weight: bold;}newRelationItem{span}{span}\(dataprovider, operator, foreinColumnName){span}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[String]} dataprovider -- The name of the primary dataprovider.
\{[String]} operator -- The operator used to relate the primary and the foreign dataproviders.
\{[String]} foreinColumnName -- The name of the foreign dataprovider.
{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[JSRelationItem] -- A JSRelationItem instance representing the newly added relation item.{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
var relation = solutionModel.newRelation('parentToChild', 'db:/example_data/parent_table', 'db:/example_data/child_table', JSRelation.INNER_JOIN);
relation.newRelationItem('another_parent_table_id', '=', 'another_child_table_parent_id');
// for literals use a prefix
relation.newRelationItem(JSRelationItem.LITERAL_PREFIX + "'hello'",'=', 'mytextfield');
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=removeRelationItem-String_String_String}{tr:id=name}{td}h6.removeRelationItem{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}void{span}{span:style=font-weight: bold;}removeRelationItem{span}{span}\(primaryDataProviderID, operator, foreignColumnName){span}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[String]} primaryDataProviderID -- the primary data provider (column) name
\{[String]} operator -- the operator
\{[String]} foreignColumnName -- the foreign column name
{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}void{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
var relation = solutionModel.newRelation('myRelation', 'db:/myServer/parentTable', 'db:/myServer/childTable', JSRelation.INNER_JOIN);
relation.newRelationItem('someColumn1', '=', 'someColumn2');
relation.newRelationItem('anotherColumn', '=', 'someOtherColumn');
relation.removeRelationItem('someColumn1', '=', 'someColumn2');
var criteria = relation.getRelationItems();
for (var i = 0; i < criteria.length; i++) {
var item = criteria[i];
application.output('primary column: ' + item.primaryDataProviderID);
application.output('operator: ' + item.operator);
application.output('foreign column: ' + item.foreignColumnName);
}
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{table}
Cache
index
true
refresh
100d
showRefresh
true
id
doc
title
Refresh page
showDate
true
retry
Enable
servoy sReturnTypes2100%height: 30px;2Supported ClientssWordListSmartClientsWordListWebClientsWordListNGClientservoy sSummary12%30%58%height: 30px;3Constants SummaryConstant for the joinType of a JSRelation.Constant for the joinType of a JSRelation.Constant for the joinType of a JSRelation.Constant for the joinType of a JSRelation.servoy sSummary12%30%58%height: 30px;3Property SummaryFlag that tells if related records can be created through this relation.Flag that tells if the parent record can be deleted while it has related records.Flag that tells if related records should be deleted or not when a parent record is deleted.Qualified name of the foreign data source.A String which specified a set of sort options for the initial sorting of data retrieved through this relation.The join type that is performed between the primary table and the foreign table.The name of the relation.Qualified name of the primary data source.servoy sSummary12%30%58%height: 30px;3Methods SummaryReturns an array of JSRelationItem objects representing the relation criteria defined for this relation.Returns the UUID of the relation objectCreates a new relation item for this relation.voidRemoves the desired relation item from the specified relation.constantservoy sDetail2100%height:30px2Constants DetailsFULL_JOINname
FULL_JOIN
dessIndent
Constant for the joinType of a JSRelation. It is also used in solutionModel.newRelation(...).
ret
Returns
sIndentclients
Supported Clients
sIndentSmartClient,WebClient,NGClientsam
Sample
sIdentjavascriptlastDetailRowINNER_JOINname
INNER_JOIN
dessIndent
Constant for the joinType of a JSRelation. It is also used in solutionModel.newRelation(...).
ret
Returns
sIndentclients
Supported Clients
sIndentSmartClient,WebClient,NGClientsam
Sample
sIdentjavascriptlastDetailRowLEFT_OUTER_JOINname
LEFT_OUTER_JOIN
dessIndent
Constant for the joinType of a JSRelation. It is also used in solutionModel.newRelation(...).
ret
Returns
sIndentclients
Supported Clients
sIndentSmartClient,WebClient,NGClientsam
Sample
sIdentjavascriptlastDetailRowRIGHT_OUTER_JOINname
RIGHT_OUTER_JOIN
dessIndent
Constant for the joinType of a JSRelation. It is also used in solutionModel.newRelation(...).
Qualified name of the foreign data source. Contains both the name of the foreign
server and the name of the foreign table.
ret
Returns
sIndentclients
Supported Clients
sIndentSmartClient,WebClient,NGClientsam
Sample
sIdentjavascriptlastDetailRowinitialSortname
initialSort
dessIndent
A String which specified a set of sort options for the initial sorting of data
retrieved through this relation.
Has the form "column_name asc, another_column_name desc, ...".
ret
Returns
sIndentclients
Supported Clients
sIndentSmartClient,WebClient,NGClientsam
Sample
sIdentjavascriptlastDetailRowjoinTypename
joinType
dessIndent
The join type that is performed between the primary table and the foreign table.
Can be "inner join" or "left outer join".
Creates a new relation item for this relation. The primary dataprovider, the foreign data provider
and one relation operators (like '=' '!=' '>' '<') must be provided.
prs
Parameters
sIndentdataproviderThe name of the primary dataprovider.operatorThe operator used to relate the primary and the foreign dataproviders.foreinColumnNameThe name of the foreign dataprovider.ret
Returns
sIndent A JSRelationItem instance representing the newly added relation item.clients