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.

Where OLD. returns unknown, has_changed returns false: a field with no previous value counts as unchanged rather than as changed, and the result is never unknown. In a creation process, where nothing is on file yet, has_changed is therefore 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.