🚀 Welcome to MDriven Learn –  MDriven is now on Discord!  Don’t miss the latest Release Notes.
OCLOperators IsDirtyMember
This page was created by Lars.olofsson on 2021-12-28. Last edited by Wikiadmin on 2026-07-29.

You can use IsDirtyMember in an OCL expression to determine whether a specific class attribute has unsaved changes; it is for expressions that must react to changes in one attribute rather than any change on the object.

Syntax

Call IsDirtyMember on the attribute that you want to inspect:

<attribute>.IsDirtyMember

The operator returns a Boolean value:

Result Meaning
true The attribute has changes pending to be saved.
false The attribute has no changes pending to be saved.

Check one attribute

For example, the following expression checks whether the SomeString attribute on the current object has been changed and is pending save:

self.SomeString.IsDirtyMember

Use this form when the expression applies to the current object and only the state of SomeString matters.

Check the attribute on multiple objects

You can evaluate the same attribute for every instance of a class by collecting the result:

Thing.allinstances->collect(x|x.SomeString.IsDirtyMember)

This expression returns the IsDirtyMember result for SomeString for each Thing instance. For example, if three Thing objects are evaluated and only the second object's SomeString has pending changes, the collected Boolean results identify that second object as changed for this attribute.

IsDirtyMember and IsDirty

Use IsDirtyMember when you need to check one attribute. Use IsDirty when you need to know whether an object has changed since the last save, regardless of which member changed.

For example:

self.SomeString.IsDirtyMember

checks SomeString, while:

self.IsDirty

checks the object.

See also