JSRelation
Last updated
Last updated
Type | Name | Summary |
---|---|---|
Type | Name | Summary |
---|---|---|
Type | Name | Summary |
---|---|---|
Constant for the joinType of a JSRelation. It is also used in solutionModel.newRelation(...).
Type Number
Sample
Constant for the joinType of a JSRelation. It is also used in solutionModel.newRelation(...).
Type Number
Sample
Constant for the joinType of a JSRelation. It is also used in solutionModel.newRelation(...).
Type Number
Sample
Constant for the joinType of a JSRelation. It is also used in solutionModel.newRelation(...).
Type Number
Sample
Flag that tells if related records can be created through this relation, or not.
This option is enabled by default, and it specifies that records can be created within a related foundset. Moreover, when records are created in a related foundset, the key columns in the new record may be automatically filled with the corresponding values from the source record.
Example: Assume a relation, _customers_to_orders_ defined by a single key expression, customers.customerid = orders.customerid
Key columns will be auto-filled for expressions using the following operators:
=
#=
^||=
If this option is disabled, then records cannot be created in a related foundset. If attempted, a [ServoyException]() is raised with the error code, [NO_RELATED_CREATE_ACCESS]().
Type Boolean
Sample
Flag that tells if the parent record can be deleted while it has related records. This option is enabled by default.
When disabled, it will prevent the deleting of a record from the source table if the related foundset contains one or more records. If the delete fails, a [ServoyException]() is raised with the error code, [NO_PARENT_DELETE_WITH_RELATED_RECORDS]().
Example: Assume the relation customers_to_orders has this option disabled. An attempt to delete a customer record will fail, if that customer has one or more orders.
Type Boolean
Sample
Flag that tells if related records (from a related foundset) should be deleted or not when a parent record is deleted. Moreover, it also enforces a cascading delete, such that when a source record is deleted, all records in the related foundset will also be deleted, eliminating the possibility of orphaned records.
Example: Assume the relation customers_to_orders has enabled this option. The deleting of the customer record will cause all of the related order records to be deleted.
The default value of this flag is "false".
Type Boolean
Sample
Qualified name of the foreign data source. Contains both the name of the foreign server and the name of the foreign table. It can be chosen from all of the available tables and has this format: "server-name.table-name". It can be any database table or view from any named server connection; it is not limited to the same database as the destination table.
At runtime, a related foundset will contain records from the destination table. NOTE: The destination table can be from a separate database than the source table. This is a powerful feature, but it is worth noting that a related foundset who's relation is defined across two databases will not be available when the source foundset is in find mode. This is because a related find requires a SQL JOIN, which cannot be issued across databases for all vendors.
Type String
Sample
Foundsets, including related foundsets, have a sort property. By default, any foundset is sorted by the primary key(s) of the table upon which it is based.
Relations have an Initial Sort property, which overrides the default sort, such that any related foundset is initialized to use the sorting definition defined by the relation object. For more information see foundset sorting.
The value looks like "column_name asc, another_column_name desc, ...".
Type String
Sample
The join type that is performed between the primary table and the foreign table. Can be "inner join" or "left outer join".
This SQL join is used when a find or a sort is performed using related criteria, and thus the join type will affect behavior in these situations.
Inner Join - SQL Inner Join does not return any rows for parent records which have no related records. Therefore, if a sort or a find is performed when a related data provider is used for criterion, the related foundset may have records omitted due parents with no child records.
Left Outer Join - SQL Left Outer Join will return always return a row for the parent record even if there are no related records. Therefore, if a sort or a find is performed when a related data provider is used for a criterion, the related foundset will include all matching records, regardless of the presence of related records.
Type Number
Sample
The name of the relation.
Type String
Sample
Qualified name of the primary data source. Contains both the name of the primary server and the name of the primary table.
Type String
Sample
Returns an array of JSRelationItem objects representing the relation criteria defined for this relation.
Returns: Array An array of JSRelationItem instances representing the relation criteria of this relation.
Sample
Returns the UUID of the relation object
Returns: UUID
Sample
Creates a new relation item for this relation. The primary dataprovider, the foreign data provider and one relation operators (like '=' '!=' '>' '<') must be provided.
Parameters
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.
Returns: JSRelationItem A JSRelationItem instance representing the newly added relation item.
Sample
Removes the desired relation item from the specified relation.
Parameters
String primaryDataProviderID the primary data provider (column) name
String operator the operator
String foreignColumnName the foreign column name
Returns: void
Sample
Constant 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.
Flag that tells if related records can be created through this relation, or not.
Flag that tells if the parent record can be deleted while it has related records.
Flag that tells if related records (from a related foundset) should be deleted or not when a parent record is deleted.
Qualified name of the foreign data source.
Foundsets, including related foundsets, have a sort property.
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.
Returns an array of JSRelationItem objects representing the relation criteria defined for this relation.
Returns the UUID of the relation object
Creates a new relation item for this relation.
void
Removes the desired relation item from the specified relation.