Computed fields
Fields can have their values automatically calculated by a function, instead of simply reading a database stored value. A computed field is declared just like a regular field, but has the additional compute argument to define the function used for its computation.
In most cases, computed fields involve writing some business logic. So, to take full advantage of this feature, we need to learn the topics explained in Chapter 8, Business Logic - Supporting Business Processes. We can still explain computed fields here, but will keep the business logic as simple as possible.
Let's work on an example. Books have a publisher. We would like to have the the publisher's country in book form.
For this, we will use a computed field, ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access