Formula Field doesn't show reference table attribute

* Describe the bug

Formula Field doesn’t show reference table attribute

* Environment

  • NocoBase version: 1.6.1
  • Database type and version: PostgreSQL 16.8
  • OS: MacOS
  • Deployment Methods: Create-nocobase-app
  • Docker image version:
  • NodeJS version: v18.20.6

* How To Reproduce

  1. Create General Collection Some Reference Table that contains Some Modifier (Field Interface: Number)
  2. Create General Collection Some Table that contains Some Number (Field Interface: Number) and Reference Table (Type: many to one, refer to Some Reference Table table)
  3. Create new formula field to multiply Some Number with Some Modifier, the expression didn’t show Reference Table field

Expected behavior

Reference Table field shown so we can select Some Modifier

Screenshots

Logs

1 Like

Hey there

I’m having exactly the same situation where basically I want to create a formula field within one of my data source. I want the formula to basically use one association field within the data source, but it seems that Nocobase does not support currently.

I would appreciate if anyone has some info about this.

Thanks!

For performance reasons, formula fields currently don’t support relationship fields and only support fields within the same table.

Is there any workaround for performing calculations using a field from the reference table? I attempted to duplicate the field and set its value using ‘Set Default Value’ in the form, but in some cases, we cannot display it to the user.

Untitled drawing

1 Like

You can leverage the workflow feature for calculations on the backend.

1 Like

Thank you very much for your answer.
Do you think that this feature could be added or is it something that would affecting the performances anyway?
Thanks again

There are potential performance risks and some hard-to-solve problems. For example, when relational data changes (even in batches), when should the values of formula fields that reference it be updated.

1 Like

Thank you for your answer.

I can see the challenges that it would be indeed.

Thanks!