...
For example, the User and the Group tables may contain many records about users and groups accordingly. A user may be in more than in one group and a group may include any users, So, in this case .,,,,,,,,, these two tables have to be bound as shown below:
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:
To create a new many-to-many relationship, please complete the steps below:
- Navigate to M2M → Create M2M;
- Fill in the fields and click Save.
Many-to-many relationship form fields
Field | Type | Description |
---|---|---|
Name | String | Relationship name. |
Source column | ||
From table | Reference | Reference to the table containing the column to bind with another one specified in the To column name field. |
From column name | 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 |
From column label | String | Specify the column label (it may differ from the column title). |
Target column | ||
To table | Reference | Reference to the table containing the column to bind with another one specified in the From column name field. |
To column name | 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 To table field; otherwise, the relationship will be disfunctional. |
From column label | String | Specify 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
...
Note |
---|
In fact, the many-to-many relationship is a table, so you can navigate into it and browse the records. In the example above (theme_has_documentation), navigate to {your_instance_url}/list/theme_has_documentation. |