Link Search Menu Expand Document

Server Data Type Relationships

One of the features that are supported by Kodika Server but not in typical Sheets is Relationships between Data Types. Relationships are a logical connection between the same or different Data Types, established on the basis of interaction among these Data Types.

What is a Relationship

Each Relationship consists of a from/parent and a to/target Data Type, which could also be the same. In addition, it defines the relationship type between them.

Relationship Types

The Relationship Type is usually defined using the terms One and Many and in the format [parent] to [target].
Available relationship types are:

  • One to Many
  • Many to One
  • Many to Many
  • One to One

In the next example, you can check how each Relationship type looks like if the from/parent is a User Data Type and the to/target is a Pet Data Type.

Create a Relationship

  1. Go to Kodika Server Data Types.
  2. Open the Data Type that you will use as from/parent Data Type.
  3. Press the + Add Property button.
  4. Select from the Server Data Types section the to/target Data Type. Note: You can select again the from/parent Data Type.
  5. Select the Relationship Type that will connect the two Data Types.
  6. Type in the name of the property that will be created in the from/parent Data Type and will be used by the new Relationship.
  7. Type in the name of the property that will be created in the to/target Data Type and will be used by the reversed Relationship.

Reversed Relationship

In Kodika, every Relationship also has a reversed relationship. The reversed relationship exchanges the Parent with the Target Data types and reverses the relationship type.

A One to Many Relationship with User as parent and Pet as target, will also create a Many to One Relationship with Pet as parent and User as target.

Use the same property for the reversed Relationship

There is a special case where you maybe need to use the same property for the reversed Relationship.
For example, if you need to create a friends relationship of type Many to Many, the reversed Relationship should use the same property.
Note: This special case works only for Many to Many and One to One.

Edit/Delete a Relationship

You can only change the name of the properties of a Relationship and not their Data Types.
You can also delete a Relationship, but it will automatically delete also the reversed Relationship. It will also delete all the relationship values in the database but will keep the records.