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

You can use minValue in OCL when you need the lowest value in a collection of simple values, such as the smallest number in a collection of amounts.

Syntax

collection->minValue()

collection is the collection to evaluate. minValue() returns the lowest value in that collection.

Example

If a collection contains the values 12, 4, and 9, this expression returns 4:

values->minValue()

Use minValue() when the values to compare are already in a collection. For example, if an expression produces a collection of order amounts, applying ->minValue() returns the lowest amount in that result.

Choose the correct minimum operator

Need Operator Example result
Find the lowest value in a collection collection->minValue() The lowest value among all items in collection
Compare one number with another number Number::min The lower of the two numbers

Related operators

Use maxValue when you need the highest value in a collection. Before evaluating a collection whose contents are optional, use isEmpty to test whether it contains any items.

See also