Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calculated Fields: Persist Values in Database #73

Open
arladmin opened this issue Oct 17, 2024 · 3 comments
Open

Calculated Fields: Persist Values in Database #73

arladmin opened this issue Oct 17, 2024 · 3 comments

Comments

@arladmin
Copy link

arladmin commented Oct 17, 2024

Extension

Something else

Describe the Improvement

Re extension: Calculated Fields Bundle

While it's great to see the long-due Calculated Fields functionality being implemented (directus/directus#3079), in some capacity, it's still missing the (pretty crucial) aspect of actually persisting the calculated values in the db, which is what the original FR was all about, at least from my perspective.

And as the FR has surprisingly already been closed, i'm creating this issue to continue the FR here.

@phazonoverload
Copy link
Collaborator

Alias fields don't return values in API requests, however as the field configuration exists in the database (including the formula), and we already know how to parse and evaluate it, I'm wondering how we can return the value via API.

I don't think persisting in the database makes sense though as it requires keeping the values in sync.

@phazonoverload
Copy link
Collaborator

Also just want to emphasise that the feature request originally only spoke about the alias interface which exists in the extension, but the community discussion suggested an expansion in scope. :)

@phazonoverload phazonoverload changed the title Request for full implementation of the Calculated Fields Feature Request Calculated Fields: Persist Values in Database Oct 19, 2024
@Zyles
Copy link

Zyles commented Nov 19, 2024

This is highly needed. Or you would need to wrap Directus with an in between API endpoint to do certain calculations before persisting.

On an insert or upsert you can't trust the client to do a calc and insert whatever number.

There are many use cases where the server itself needs to calculate and cache a value.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants