You are here:
Datasource Contract Definition
Use the various elements that constitute a datasource contract to define a datasource.
Required Editions
| Available in: Enterprise, Performance, and Unlimited Editions |
The DataSource element is the top-level element of a
datasource contract.
<DataSource name="DsBoVisit" businessObjectClass="BoVisit" external="false" editableEntity="Visit" backendSystem="sf" schemaVersion="2.0">
The table lists the supported attributes in the DataSource element.
| Attribute | Description | Value or Pattern | Required |
|---|---|---|---|
| name | Unique name of the datasource. | Literal | Yes |
| businessObjectClass | Name of the assigned business object. | Literal | Yes |
| external | Indicates whether the datasource contract uses an external datasource. Default value is True, which means that the datasource contract was written by using the external format, also known as the old or manual format. External data sources provide Javascript methods to build the Select, Update, Insert, or Delete statements. |
Boolean | No |
| editableEntity | Name of the editable entity or table. | Literal | No |
| distinct | Specifies if a distinct SELECT statement is generated. The default value is False. | Boolean | No |
| readOnly | Specifies if the Update, Delete, and Insert statements are generated. The default value is False. When the value is set to true, the statements aren’t generated. | Boolean | No |
| schemaVersion | Version of the design contract. | Literal | Yes |
| backendSystem | Specify sf as the target backend system of the data source. | Literal | Yes |
You can use these elements in a datasource contract.
| Element | Description | Required |
|---|---|---|
Attributes
|
Container element that contains all attributes of a data source. By itself, the Attributes property doesn’t have any attributes, but it can
contain Attribute, DerivedAttribute, DateTimeAttribute, and
PivotItems sub nodes. For more information, see Attributes. |
Yes |
Entities
|
Specifies the database table that the data is collected from. By itself, the Entities property doesn’t have any attributes, but it can
contain a list of Entity sub nodes. For more
information, see Entities. |
Yes |
QueryCondition
|
Use |
Yes |
Parameters
|
Specifies the element value which calls the datasource for execution. You can model and use parameters in the JOIN and QUERY conditions to filter the result set. A parameter replaces the corresponding query condition macro during run time. The name attribute in Parameter replaces the corresponding macro in the query condition. For more information, see Parameters. Here’s the name of a pKey attribute. |
No |
OrderCriteria
|
Describes the sorting order of the query result set. These are the attributes in
Here’s an example: |
No |
GroupBy
|
Defines the attributes and their order used to create the GroupBy clause of the SELECT
statement. The grouping criteria consist of one or more |
No |
GroupByCriterion
|
These attributes are required in a
|
No |
| Macros | Macros are shortcuts used in the SQL statements that are replaced at run time. There are framework macros and parameter macros that are customizable at design time. For more information, see Macros. | No |
QuickSearchParameters
|
Use
For example, |
No |
ConditionalParameters
|
Use conditional parameters for optional WHERE conditions. These conditions only apply only if the parameters passed to the data source contain the named parameter. The sub nodes
of
|
No |
Comparison Operators
Use these comparison operators within the join or WHERE clause.
| Operator | Equivalent SQL Operator | Description |
|---|---|---|
| EQ | = | Equal to |
| NE | <> | Not Equals |
| LT | < | Less Than |
| LE | <= | Less Than or Equal to |
| GT | > | Greater Than |
| GE | >= | Greater Than or Equal to |
- Attributes
Use attributes and its sub elements to specify the columns you want to fetch from the database and build the SQL statement. - PivotItems
PivotItems in a datasource contract cover the differences between schemas. - Entities
Use entities to specify the tables to fetch the data columns from. - Parameters
Parameters are modeled and can be used in the JOIN and QUERY conditions to filter the result set. - Standard Macros
Macros are shortcuts used in SQL statements that are replaced at run time. - Sample SQL Statement Generated From a Datasource Contract
This sample shows the SELECT statement generated for a datasource contract

