Storing calculations from expressions in the data model #2768
Labels
area/logic
related to logic/dynamics/expressions
kind/feature-request
New feature or request
org/ssb
Issues relevant for Statistisk sentralbyrå.
status/triage
Description
Early on in the expression language project, it was assumed that expressions would take over from
RuleHandler
in every way in the future, such that jS-based rules could be deprecated and removed at some point. We're getting closer, but there's one big missing part - doing calculations and storing those in the data model.Right now there's two main ways to perform calculations:
RuleHandler
. This will run in app-frontend and can take leaf values, leaf values from repeating groups, and leaf values from nested repeating groups. The output can be stored as a single leaf value.ProcessDataWrite
on the backend. This is much more flexible, but also binds the frontend tightly to the backend and the data processor there (as an effect, many apps need to save data frequently in order for dynamic effects in the app to occur at all - and consequently a failed save operation cannot be handled gracefully).Doing this with expressions would introduce a third, and one with benefits over the other two:
Storing calculation results must not be confused with:
Text
,Number
andDate
components.During a meeting with SSB today, we discussed this slightly, and talked about a few different solutions:
dataModelBinding
for components #1178It could be argued that slapping on a
dataModelBindings
in addition to the existing config would make sure this expression value was stored and shown. However, it gets muddy when settingreadOnly: false
. What happens when the user types into theInput
at that point is unclear.Related issue(s)
dataModelBinding
for components #1178The text was updated successfully, but these errors were encountered: