In Part 1 we summarized the basic components of Rollbase Objects and in Part 2 we took a quick look at Fields which are the primary building block of Objects. Beyond fields the most important Object components are Relationships.
Relationships are established between two objects as a way to connect different types of data in your applications. For example, lets say we're building an application to create Quotes which consist of Quote Line Items, where each Quote Line Item is associated with a specific Product. In this example a Quote object is related to a Quote Line Item object, and the Quote Line Item object is related to a Product object. Since each Quote has many Quote Line Items, we say there is a "One to Many" relationship between the Quote and Quote Line Item objects. Similarly, since each Quote Line Item only has one Product associated with it, but each Product can be used in any number of Quote Line Items, there is a "Many to One" relationship between Quote Line Item and Product.
Note: This "One to Many", "Many to One", "One to One", or "Many to Many" terminology is referred to as the Cardinality of the relationship.
By creating relationships between objects in Rollbase you can rapidly model sophisticated business applications with simple or complex interdependencies. Once a relationship is established, information about that relationship can be used to customize pages, views, templates, charts, reports and many other application components based on your application's needs. For example, in the screenshot below we're showing a Quote View page with a Related View component displaying all of the Quote Line Items associated with a particular quote record via a relationship. This Related View also demonstrates how each Quote Line Item is displaying information about related Product records here and we are able to execute formula-based calculations on fields from multiple related objects.

As another example, below we are showing a spreadsheet generated from a Document Template associated with the Quote object. This template was constructed from merge fields using Quote fields and fields from the related Quote Line Item object definition, as well as fields from other objects such as Customer and Account.
We will discuss Document Templates in a future post, but suffice it to say here, like many other object components they allow us to loop through related items and use information about each item to generate an appropriate result -- in this case an Excel Spreadsheet showing all line items, subtotals, totals, etc. A similar output could be just as easily generated in the form of a Word document or rich HTML email. None of this would be possible without Relationships.

When creating a relationship in Rollbase you are first presented with a list of object definitions to choose from. Choose the object you want to establish a relationship with (don't worry about the complex implications of creating multiple relationships between the same objects, Rollbase will handle this for you under the covers). Once you select the target object you'll need to specify whether the relationship is a Simple Relationship or a Complex Relationship.
Simple Relationships
Simple relationships are direct relationships between two objects. For example a simple relationship created between object A and object B means that records of type A can directly reference records of type B and vice versa.

When defining a new Simple relationship you must define relationship properties, cardinality, orphan records control and cloning control settings (discussed below). Relationship properties require you to assign singular and plural names for each side of the relationship, as well as a unique integration name. For example, if you are creating a relationship between Quote and User objects, you might use “Owner” and “Owners” to represent the user side of the relationship.
Relationship cardinality determines whether records of each type can have one or more than one related record. You can select One-to-One, One-to-Many, Many-to-One, Many-to-Many.

Complex Relationships
Complex relationships are used in cases where information about the relationship itself is required to be stored and managed. In our example above, a Quote Line Item essentially represents a complex relationship between Quote and Product objects in order to manage relationship data such as Quantity.

When you create a complex relationship a new object definition is automatically created to represent the relationship between the source and target objects. Simple relationships are then created between the source object and the intermediate object, and between the intermediate object and the target object. In this way you can create fields and other components in the intermediate object to store as much information about the relationship as you need.
Orphan Records Control
Orphan records control allows you to specify whether or not related records get deleted whenever a parent record is deleted. For example if we delete a Quote we might also want to delete all of the related Quote Line Item records as well. But the opposite case is not true, that is if we delete a Quote Line Item we do not want to delete the related Quote record. Rollbase allows you to control this kind of behavior for each relationship.
Cloning Control
Cloning control allows you to specify whether or not related records get cloned whenever the parent record is cloned. For example if we clone a Quote we might also want to clone all of the related Quote Line Item records as well. But the opposite case is not true, that is if we clone a Quote Line Item we do not want to clone the related Quote record. Rollbase allows you to control this kind of behavior for each relationship.
Lookup Fields
When creating a new relationship Rollbase will also create Lookup fields and Related View components for each object. Lookup fields are used to select one or more related object records when editing or creating a new record.
By default Lookup fields allow you to pick one or more records by displaying a Selector Page in a popup (we will discuss selector Pages and popups in a future post). However, often times it is faster and more convenient to allow users to select records using a picklist or multi-select picklist. Rollbase allows you to change whether a Lookup field displays as a popup selector or a picklist/multi-select picklist via a page level property.
Related Views
Related Views are used to display a list of related records for objects with One-to-Many or Many-to-Many relationships. For example, the Quote View page shown in the beginning of this post contains a Related View component that displays all related Quote Line Item records. Related Views are identical to View components only they are inherently filtered by the relationship established between the object record being viewed and its related records (we will discuss Views and Related Views in more detail in a future post).
Although we have only presented a few small examples of how Relationships can be used here, they are a critical component of almost every Rollbase application you will install or buld and are pre-requisites for many advanced features such as Multi-layer Reporting, Workflow Event Conditions, Formula Fields, Templates, etc. Stay tuned for Part 4 where we will introduce Object Pages and the Rollbase Page Editor.