Skip to content

has_changed

Info

New in Atfinity 17.

Description

has_changed is true when a field holds a different value now than it did in the previous state of its instance. It reads the field once, so it replaces comparing the path with OLD. against itself.

Filling a field that was empty on the instance is a change, and so is clearing one that held a value, so where OLD. returns unknown because there was nothing on file has_changed is still true. The result is never unknown. Where the instance has no previous state at all, as in a creation process, has_changed is always false.

It takes exactly one field path and nothing else, so has_changed(OLD.p.first_name), has_changed(p.first_name, p.last_name) and has_changed(true) are rejected when the rule is validated. The path may cross relationships, structures and list indexes.

Example

p is Person
has_changed(p.residence_address)

Attach this to a proof and the case asks for a new utility bill only for clients whose address this review actually changed. The rest of the clients keep the proof they already gave.