The old() function

The Novulo offers a built-in old() function. It shows a previous value of a record when this record is being (but not yet) updated.

For example, there is a book record with the category “Crime”. If we click to “Edit” this book and change (but not save yet!) a category to “Biography”, we could see old and new values in the expression gebugger: old() = crime, new = biography.

Uncheck the “Read uncommitted” checkbox under the “Other” tab.

As soon as we saved changes, the old category name will be showed as biography. When a record is not locked, the old() value is always equal to the current value.

More about locking records is here: Lock record, exclusive lock, database lock and model lock

The old() function could be useful in Novulo data processes (beforeInsert or beforeUpdate) to compare values: the previous and the new one that is made but not saved yet. This can be used for logging mutations, etc.

Check also: Best practice for change logs or mutations