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
For more information see [Relations]
{column:width=80px|padding=0px}{column}{column}{column}
Constants Summary
INNER_JOIN
Constant for the joinType of a JSRelation.
LEFT_OUTER_JOIN
Constant for the joinType of a JSRelation.
RIGHT_OUTER_JOIN
Constant for the joinType of a Query Builder join.
{column:width=80px|padding=0px}{column}{column}{column}
Property Summary
allowCreationRelatedRecords
Flag that tells if related records can be created through this relation.
allowParentDeleteWhenHavingRelatedRecords
Flag that tells if the parent record can be deleted while it has related records.
deleteRelatedRecords
Flag that tells if related records should be deleted or not when a parent record is deleted.
foreignDataSource
Qualified name of the foreign data source.
initialSort
A String which specified a set of sort options for the initial sorting of data
retrieved through this relation.
primaryDataSource
Qualified name of the primary data source.
{column:width=80px|padding=0px}{column}{column}{column}
Method Summary
getRelationItems()
Returns an array of JSRelationItem objects representing the relation criteria defined for this relation.
newRelationItem(dataprovider, operator, foreinColumnName)
Creates a new relation item for this relation.
void
removeRelationItem(primaryDataProviderID, operator, foreignColumnName)
Removes the desired relation item from the specified relation.
{column:width=100%|padding=0px}{column}
Constants Details
Sample
/** @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))
Sample
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))
Sample
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))
Sample
/** @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))
{column:width=100%|padding=0px}{column}
Property Details
Sample
var relation = solutionModel.newRelation('parentToChild', 'db:/example_data/parent_table', 'db:/example_data/child_table', JSRelation.INNER_JOIN); relation.allowCreationRelatedRecords = true;
Sample
var relation = solutionModel.newRelation('parentToChild', 'db:/example_data/parent_table', 'db:/example_data/child_table', JSRelation.INNER_JOIN); relation.allowParentDeleteWhenHavingRelatedRecords = false;
Sample
var relation = solutionModel.newRelation('parentToChild', 'db:/example_data/parent_table', 'db:/example_data/child_table', JSRelation.INNER_JOIN); relation.deleteRelatedRecords = true;
Sample
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';
Sample
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';
Sample
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))
Sample
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;
Sample
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';
{column:width=100%|padding=0px}{column}
Method Details
getRelationItems
()
Returns
JSRelationItem[] – An array of JSRelationItem instances representing the relation criteria of this relation.
Sample
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); }
Sample
var relation = solutionModel.newRelation('parentToChild', 'db:/example_data/parent_table', 'db:/example_data/child_table', JSRelation.INNER_JOIN); application.output(relation.getUUID().toString())
newRelationItem
(dataprovider, operator, foreinColumnName)
Returns
JSRelationItem – A JSRelationItem instance representing the newly added relation item.
Sample
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');
void
removeRelationItem
(primaryDataProviderID, operator, foreignColumnName)
Returns
void
Sample
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); }