Skip to content

Navigation Menu

Sign in
Sign up

feat: add relation lookup column type - #2271

Open
Koc wants to merge 2 commits into
main from
feature/add-lookup-column-type
Open

feat: add relation lookup column type #2271
Koc wants to merge 2 commits into
main from
feature/add-lookup-column-type

Conversation

@Koc

@Koc Koc commented Jan 19, 2026
edited
Loading

Copy link
Copy Markdown
Contributor

This is continuation of #2248 that allows to display more column from relation table.
There are 2 tables: employees and vacations. We can add vacation.requester relation column that referenced to the row id of the employee and display employee.name. But what if we need to display more column from the related table? e.g. employee.department. That's where relation lookup can help: select already existent relation and choose what extra column should be displayed.

🖼️ Screenshots

image

image

🗒️ TODO

AIlkiv and ralfhandl reacted with rocket emoji
@Koc Koc changed the title (削除) Feature/add lookup column type (削除ここまで) (追記) feat: add lookup column type (追記ここまで) Jan 19, 2026
Koc changed the base branch from main to feature/add-relations-column-type January 19, 2026 16:47
Koc force-pushed the feature/add-lookup-column-type branch 3 times, most recently from abbdf56 to 30a0005 Compare January 19, 2026 17:46
@Koc Koc mentioned this pull request Jan 20, 2026
2 tasks
@Koc Koc added the enhancement New feature or request label Jan 21, 2026
Koc force-pushed the feature/add-relations-column-type branch 2 times, most recently from f34f8f9 to d406233 Compare January 25, 2026 12:47
Koc force-pushed the feature/add-relations-column-type branch 5 times, most recently from 502b69b to 8093d63 Compare February 15, 2026 16:40
Koc force-pushed the feature/add-relations-column-type branch 7 times, most recently from d45b95c to cb637bd Compare February 28, 2026 18:32
enjeck force-pushed the feature/add-relations-column-type branch from cb637bd to 9b36f43 Compare March 4, 2026 04:59
Koc force-pushed the feature/add-relations-column-type branch 3 times, most recently from b47617a to 3240639 Compare March 25, 2026 23:07
enjeck force-pushed the feature/add-relations-column-type branch from 3240639 to 0cdfefa Compare April 23, 2026 03:47
Koc force-pushed the feature/add-relations-column-type branch 3 times, most recently from b707106 to f3c29d8 Compare May 4, 2026 21:45
Koc force-pushed the feature/add-relations-column-type branch from f3c29d8 to b426237 Compare May 7, 2026 14:05
Koc force-pushed the feature/add-lookup-column-type branch 2 times, most recently from a94d637 to ac1036d Compare July 15, 2026 22:58
@Koc Koc changed the title (削除) feat: add lookup column type (削除ここまで) (追記) feat: add relation lookup column type (追記ここまで) Jul 19, 2026
@Koc Koc mentioned this pull request Jul 19, 2026

@enjeck enjeck left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even with the screenshots, I'm not sure what we're adding and what the usecase is?

Koc commented Jul 20, 2026

Copy link
Copy Markdown
Contributor Author

@enjeck I've updated description:

There are 2 tables: employees and vacations. We can add vacation.requester relation column that referenced to employee.name. But what if we need to display more column from the related table? e.g. employee.department. That's where relation lookup can help: select already existent relation and choose what extra column should be displayed.

Comment thread src/modules/modals/CreateRow.vue Outdated
Comment on lines +66 to +71
if (column.type === ColumnTypes.RelationLookup) {
rowData[column.title] = this.getRelationLookupValue(column, row, dataStore)
} else {
const set = row.data ? row.data.find(d => d.columnId === column.id) || '' : null
rowData[column.title] = set ? column.getValueString(set) : ''
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

try to omit if/else and move functionality to the column class

Koc force-pushed the feature/add-lookup-column-type branch 4 times, most recently from e3d186a to dd0bdd6 Compare July 25, 2026 13:43

This comment was marked as resolved.

Koc force-pushed the feature/add-lookup-column-type branch from dd0bdd6 to af54364 Compare August 24, 2026 22:06

enjeck commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

That's where relation lookup can help: select already existent relation and choose what extra column should be displayed.

Having a relation column, and a lookup column is extremely confusing. Even with this, I had to think extra hard to understand how they're different. If I'm struggling to understand as the dev, I doubts users will easily get it (or maybe it's just me, lol).

I would need others to check if they understand this just from the description and images. Maybe @nextcloud/designers need to weigh in

Koc commented Aug 30, 2026
edited
Loading

Copy link
Copy Markdown
Contributor Author

well, that's pretty similar to Excel's VLOOKUP function. But I'm open to changes here, let's wait for our designers

Signed-off-by: Kostiantyn Miakshyn <molodchick@gmail.com>
Koc force-pushed the feature/add-lookup-column-type branch 4 times, most recently from 4362724 to 9667d06 Compare August 30, 2026 12:04
Signed-off-by: Kostiantyn Miakshyn <molodchick@gmail.com>
Koc force-pushed the feature/add-lookup-column-type branch from 9667d06 to e7ff045 Compare August 30, 2026 12:05
- SPDX-License-Identifier: AGPL-3.0-or-later
-->
<template>
<component :is="cellComponent"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

replaced with a simple function

kra-mo commented Aug 31, 2026

Copy link
Copy Markdown
Member

I certainly think the names should be changed at least. @marcoambrosini, ideas?

Let's also just say that Excel's ancient statistics-oriented DSL is maybe not the best language to draw inspiration from when it comes to design ;)

marcoambrosini commented Sep 3, 2026
edited
Loading

Copy link
Copy Markdown
Member

the "Lookup" term is used for this in both Baserow and Airtable. For the relational ones they use the wording "Link to table". I would do the same

Maybe this can help: https://baserow.io/user-docs/lookup-field

samin-z self-requested a review September 8, 2026 08:20
:loading="loadingRelationColumns"
:aria-label-combobox="t('tables', 'Select relation column')"
required
@input="onRelationColumnChange" />

@samin-z samin-z Sep 9, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

after picking a relation column, target cplumn stays empty 'No results'. this select use @input, but NcSelect needs @update:model-value, with that change the target columns load correctly.

:loading="loadingTargetColumns"
:aria-label-combobox="t('tables', 'Select target column')"
required
@input="onTargetColumnChange" />

@samin-z samin-z Sep 9, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as previous comment.

[ColumnTypes.SelectionMulti]: TableCellMultiSelection,
[ColumnTypes.SelectionCheck]: TableCellYesNo,
[ColumnTypes.Relation]: TableCellRelation,
[ColumnTypes.RelationLookup]: TableCellRelationLookup,

@samin-z samin-z Sep 9, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lookup cells still open as an empty text editor. RelationLookup is register here, but TableRow uses getTableCellComponent from TableCell.js, which doesnt include it and falls back to TableCellHtml. you should add the same mapping in TableCell.js.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@samin-z samin-z samin-z requested changes
@blizzz blizzz Awaiting requested review from blizzz blizzz is a code owner
@enjeck enjeck Awaiting requested review from enjeck enjeck is a code owner

Requested changes must be addressed to merge this pull request.

Assignees

No one assigned

Labels

enhancement New feature or request

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /