Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Many-to-many

...

inter-table relationships allow defining connections between

...

the entries of any two tables, with specifying the relationship type other than "

...

one-to-

...

one".

...

For example, the User and the Group tables may contain many records about users and groups accordingly. A user may be in more than

...

one group, and a group may include

...

many users,

...

so, in this case

...

, these two tables have to be bound as shown below:

Image Added

...

The many-to-many table is a table describing how two tables are linked with each other. You can find a typical example of such a linkage on the screenshot below:

Image Modified

To create a new many-to-many relationship, please complete the steps below:

  1. Navigate to M2M → Create M2M table.
  2. Fill in the fields.
  3. Click Save or Save and Exit to apply changes.
Tip

Role required: security_admin.

Many-to-many relationship form fields

FieldMandatoryTypeDescription
NameYStringA relationship name.
Source column
From

...

Column LabelNStringSpecify the column label (it may differ from the column title).
From Column NameY

...

String

Specify the column to bind with another one. Use the system name of the column taken from the column properties.

...

 The column should be presented in the table specified in the From Table field; otherwise, the relationship will be disfunctional.


Tip

To get the system name of a column, please navigate to the All Columns list or to the Realted Lists area in the table form.


From TableYReferenceReference to the

...

table containing the column to bind with another one specified in

...

the To Column Name field.

...

Target column

...

...

To Column LabelNStringSpecify the column label (it may differ from the column title).

From column name and To column name это тип связей многие ко многим, например, у нас есть много пользователей, и есть много групп, пользователь может быть во многих группах, и группа может включать любых польхзователей. From column name and To column name - они будут содержать зачастую sys_id колонки тех таблиц, которые нам надо связать.

M2M таблица это таблица с 2 колонками, которую нам надо... записи которой говорят о том, как связаны записи из двух разных таблиц. Вот, например: https://spa-target.simpleone.ru/record/sys_m2m/155964310500000003, это запись в m2m.

user и group test это м2м для юзеров и групп. column name - это name (from column name), а to - это group. Это значит, в таблице user должна быть колонка name, а в таблице group есть колонка group. В этом можно убедиться, провалившись в таблицу по референсу.

From column name and To column name это могут быть... From column name это любая колонка из таблицы from table, но при этом желательно, чтобы она была уникальна. Аналогично для To column name, это колонка из таблицы To table, опять же желательно, чтобы она была уникальна.

В данном случае name и group считаем уникальными. From table, to table - это две таблицы, которые нам надо связать.

From column label, to column label - это какие-то лейблы (предположительно тайтлы) для данных колонок. Лейбл можно задать любой, отличный от того лейбла, уже существующего к данной колонке, а from/to column name - нужно указывать системное имя.

Название связи - m2m_user_group_test. Это значит, что существует таблица с таким именем. Т.е. если зайти в /list/m2m_user_group_test. можно увидеть свойства этой связи. 

https://spa-target.simpleone.ru/record/sys_m2m/156527600200267290 - норм пример (theme_has_documentation)

Если в любую запись этой таблицы заходить, то видно, что там тема и связанный документ.

from_column_name

to_column_name

from_column_label

to_column_label

from_table_id

To Column NameYString

Specify the column to bind with another one. Use the system name of the column taken from the column properties. The column should be presented in the table specified in the To Table field; otherwise, the relationship will be disfunctional.

Tip

To get the system name of a column, please navigate to the All Columns list or to the Realted Lists area in the table form.


To TableYReferenceReference to the table containing the column to bind with another one specified in the From Column Name field.

...