View Definition

Views in Gospel are similar to SQL views. This feature enables you to create a view by combining data that exists in one or more record definitions. Since the data in the view is dynamically generated from the two existing records, they are read-only. 

The data is organised in two different records as fields and values, with a unique key identifying each row. Each record has its own unique key. Data in a record can be linked to data in other records by combining the data for the unique key of the linked data. For example, Record Employee and Record Passport contain user-related information. Both the records contain a User ID field with values that are unique in the individual records, but common to both the records. A view can be created by combining data common to this unique field.

Defining the relationship between the records

When creating a view, you have to define a relationship between the two records. A relationship is established when the value in  the FROM (base) record compares successfully with a value in the TO record and matches the criteria you specify when defining the view. We currently support one-to-one and a one-to-many relationship.

One-to-one relationship

A one-to-one relationship exists when one field in a record is associated with one and only one field in another record. For example, in a company, a person can have only one passport number, which is unique to only that person. 

One-to-many relationship

A one-to-many relationship exists when a field in a record can be associated with one or more fields in another record or one or more fields in a record can be associated with one field in another record. For example, an employee can belong only to one department, but the department can have many employees.