ACTION: Erik to report evaluating vars in model

All,

I found that we already had some documented rules: [1]

- `xf:var` elements are directly under the `xf:model` element
- the variables are evaluated in the order in which they appear
- they are visible from
    - `xf:bind`
    - `xf:submission`
    - nested actions
    - the view, when the given model is in scope (default, or with `model`)

Evaluation:

The variables are evaluated "as needed". Specifically, they need to be up
to date:

- before a rebuild if used by `xf:bind/@ref`
- before a recalculate if used by other MIPs
- before a refresh, if used in the view

However, there is no requirement that they be recomputed specifically just
before running an action.

A model variable can use the `bind()` function, and an `xf:bind/@ref` can
use a variable, but there is no dependency system mandated. The expectation
is simply that model variables are re-evaluated if needed before a rebuild.

After years of use of variables in `xf:model`, I think it is an obvious
feature to have in the spec.

-Erik

[1] https://doc.orbeon.com/xforms/core/variables#variables-within-xf-model

Received on Friday, 22 November 2024 00:21:57 UTC