* feat(nocodb): add support for limiting selection to specific views
* test: fix failing tests
* fix: failing playwright tests
* feat: allow updating static view filter from both sides
* fix: remove console logs
* refactor: rename migration name
* fix: corrections in ui and update api
* fix: apply same behaviour for LTAR column(bt)
* refactor: rename view id column in relation to avoid confusion
* fix: option to disable view filter(switch)
* refactor: some minor ui spacing corrections
* fix: avoid setting target view id for bt relation when creating hm relation
* feat: links - record selection based on custom filters
* fix: corrections
* feat: add edit support for conditions
* feat: option to switch between dynamic and static value
* fix: backend corrections
* feat: apis for links filter
* feat: filter api integration with ui
* feat: filter with save and update
* feat: dynamic filter
* feat: shared form filter
* feat: expanded form
* fix: missing imports and corrections
* fix: pass correct column list
* fix: nested filter bug
* fix: corrections in actions and swagger
* fix: missing add button menu
* fix: expanded form bug
* test: playwright test - WIP
* test: playwright - link with filters/view
* chore: lint
* refactor: ui corrections
* fix: remove unnecessary filtering from hm/mm list and count
* fix: filter ui correction
* fix: lable correction
* fix: skip view filter for rollup
* fix: ui corrections
* fix: extract correct column id
* fix: duplicate LTAR - missing target view
* feat: add duplicate support for link with filters/view
* fix: height issue and nested filter creation bug
* fix: pass metadata to nested filter component
* fix: filter on column creation
* fix: filter getting cloned under group
* fix: exclude deleted filters when deciding locked state
* fix: update state when switching to dynamic filter
* fix: unlink view on delete and handle undefined values as null
* fix: filter based on unsaved data
* fix: handle overflow
* fix: multi-field editor - filter UI correction
* fix: duplicate link column with dynamic field ref
* fix: remove virtual column support
* fix: add support to link filter in normal list method
* fix: apply filter on count query
* fix: pass correct column list
* feat: add link filter support in multifield column creation
* feat: add link filter support in multifield column creation
* Merge branch 'develop' into feat/links-view-filter
* fix: dynamic value column export
* fix: review comments
* test: kludge for groupby tests
* fix: extract updated status correctly
* test: try waitFor for links
* test: kludge
* refactor: exclude attachment & rating from dynamic filter and treat float and integer as number
* test: label correction
* refactor: replace try...catch and use if condition
* fix: apply conditions only if enabled
* fix: MFE bugs
* refactor: show radio button active border only when focused
* fix: proper state handling
* fix: view delete - unlink from link column
* fix: duplicate Link with filter view id
* refactor: column filter section padding
* fix: exclude system columns
* fix: dynamic column filter logic correction
* refactor: cleanup
* test: kludge with delay for groupby test
* refactor: add missing placeholder method
* docs: limit link record selection
* refactor: add missing placeholder method
* chore: lint
---------
Co-authored-by: DarkPhoenix2704 <anbarasun123@gmail.com>
Co-authored-by: Raju Udava <86527202+dstala@users.noreply.github.com>
`Links` field type is used to establish relationship between tables & create links to other records.
`Links` field type is used to establish relationship between tables & create links to other records.
NocoDB supports following types of relations:
NocoDB supports following types of relations:
- `Has-Many` - A record in one table can have multiple records in another table.
- `Has-Many` - A record in one table can have multiple records in another table.
- Example: A `Country` can have multiple `Cities`.
- Example: A `Country` can have multiple `Cities`.
- `Belongs-to` - Multiple records in one table can have a single record in another table.
- `Belongs-to` - Multiple records in one table can have a single record in another table.
- Example: A `City``Belongs-to` a `Country`.
- Example: A `City``Belongs-to` a `Country`.
- `Many-to-Many` - Multiple records in one table can have multiple records in another table.
- `Many-to-Many` - Multiple records in one table can have multiple records in another table.
- Example: A `Student` can have multiple `Subjects`& a `Subject` can have multiple `Students`.
- Example: A `Student` can have multiple `Subjects`& a `Subject` can have multiple `Students`.
:::note
:::note
- Links can be created only between tables in the same database.
- Links can be created only between tables in the same database.
- Self-referencing links are supported. (Link to the same table)
- Self-referencing links are supported. (Link to the same table)
- For every `Has-Many` relation defined, NocoDB augments `Belongs-to` relationship field in the adjacent table automatically
- For every `Has-Many` relation defined, NocoDB augments `Belongs-to` relationship field in the adjacent table automatically
:::
:::
## Create a link field
## Create a link field
1. Click on `+` icon to the right of `Fields header`
1. Click on `+` icon to the right of `Fields header`
2. On the dropdown modal, enter the field name (Optional).
2. On the dropdown modal, enter the field name (Optional).
3. Select the field type as `Links` from the dropdown.
3. Select the field type as `Links` from the dropdown.
4. Select the relation type : Either `Has-Many` or`Many-to-Many`.
4. Select the relation type : `One-to-one`, `Has-Many`, OR`Many-to-Many`.
5. Select the table to which the relation is to be established with.
5. Select the table to which the relation is to be established with.
6. Configure label to be used for display in the cell. Defaults to `Link`, `Links` (Optional).
6. Advance settings: Configure label to be used for display in the cell. Defaults to `Link`, `Links` (Optional).
7. Click on `Save Field` button.
7. Click on `Save Field` button.
![image](/img/v2/fields/types/links.png)
![image](/img/v2/fields/types/links.png)
You can control record visibility in the `Link records` modal by limiting the records available for selection. [Read more](#limit-record-selection)
### Cell display
### Cell display
The cell will display number of links for a record to the related table.
The cell will display number of links for a record to the related table.
![image](/img/v2/fields/links-cell-display.png)
![image](/img/v2/fields/links-cell-display.png)
@ -49,10 +51,10 @@ List of linked records will appear as a dropdown containing linked records as ca
3. List (cards) of linked records
3. List (cards) of linked records
4. To view additional information (expanded record), hover on the card & click on the `<>` icon
4. To view additional information (expanded record), hover on the card & click on the `<>` icon
5. Click on the `-` icon to unlink the record
5. Click on the `-` icon to unlink the record
6. Click on `+ New record` button to create and link a new record to the current one
6. Click on `+ New record` button to create and link a new record to the current one
7. Click on `Link more records` to link an existing record [Read more](#link-new-records)
7. Click on `Link more records` to link an existing record [Read more](#link-new-records)
8. Pagination bar
8. Pagination bar
### Link new records
### Link new records
Modal to add new links can be opened by
Modal to add new links can be opened by
@ -82,6 +84,63 @@ To unlink a record, open the `Linked Records` modal & click on the `-` icon on t
Multiple records can be unlinked at once.
Multiple records can be unlinked at once.
:::
:::
### Related fields
## Limit record selection
This feature enables users to restrict the records available for selection within the `Link records` modal. This can be achieved by two modes:
- Limit by view
- Limit by filter ☁
Note that,
- These options are not mutually exclusive & can be used together. When both are used, the records available for selection will be the **intersection of the records satisfying all conditions**.
- This feature only affects the records available for selection &**does not affect the existing links**.
- The limit is applied only on the **Link records** modal & does not restrict the link modification process via API, Copy-Paste or any other mechanisms.
- **Limit by filter** option is available only in cloud version.
### Limit by view
To limit the records available for selection based on a view, follow the steps below:
#### Steps
1. Enable `Limit record selection to view`
2. Select the view from the dropdown
3. Click on `Save Field` button
![image](/img/v2/fields/types/limit-by-view.png)
In the example image above, the records available for selection will be limited to the records available in `Trailers` view.
Note that,
- Only one view can be selected at a time.
- Deleting the view associated with links field will disable the limit by view option.
- Change in filters within the view will also reflect records available for selection during linking.
### Limit by filter ☁
To limit the records available for selection based on filters, follow the steps below: