Create relations between datasets

Jexia allows you to relate two or more datasets and filesets and create one-to-many or many-to-many relationships between them. Relations are established under the hood, so you should not worry about specifying fields for relation. While fetching the data you can get only parent record or parent + child records. For example : Post <- Comments <- User 

Create a relation

In order to create a relation between a fileset and a dataset, head over to the "Relations" tab in the dashboard:

Drag and Drop

Drag and drop a line from the dataset to the fileset. Next, a screen will pop up asking you to choose the cardinalities. 

Choose the relation type

Choose the type of relation you want to create: one-to-many or many-to-many.

Here is a code example on how to insert related records. More examples and details are provided here

    title: "Relations with Jexia SDK",
    message: "A do like how Jexia SDK implements relations!",
    comments: [{
      text: "Me too!",
      like: true,
      author: { email: "" }
    }, {
      text: "Might've been a bit better :(",
      like: false,
      author: { email: "" }

Frequently Asked Questions about working with Relations

In which case you can do this
You can create relations between datasets, filesets and users. You need to have at least one dataset or fileset created for that.

How to create a relation?
There is a WYSIWIG editor that you can use for that. See Relations in the Services block in the side menu. Then select a dataset and drag a line towards another dataset you want to add relation to. Set the type of relation and that’s it.

Do I need to select a field for a relation?
No, you don’t. This is not needed because the relation fields are set automatically.

How to insert data into related datasets?
An example on how to do that is found here (see Related records)

How to use Attach / Detach?
An example on how to do that is found here (see Attach / Detach)

How to delete a relation?
First select the relation you are going to delete and then press Del key. Confirm the deletion.

How many relations I can create?
The number of relations is unlimited.