🚀 Welcome to MDriven Learn –  MDriven is now on Discord!  Don’t miss the latest Release Notes.
OCLOperators length
This page was created by Hans.karlsen on 2024-10-16. Last edited by Wikiadmin on 2026-07-29.

You can use the length operator when you need the number of characters in a string, for example when evaluating whether entered text has content of a required size.

What length returns

length is a string operator that returns an integer: the number of characters that compose the string.

For example, the string Car has a length of 3. A rule can use that result to distinguish a short value from a longer value.

Use length for the current value

Use length when you need to evaluate the text currently held by a string value. Typical uses include conditions and validations that depend on the number of characters supplied.

For example, if a value is ABC, its length is 3. If the value changes to ABCD, its length is 4.

Actual length and allowed length

Do not confuse the current string length with the maximum length configured for a string attribute.

Need Use Example
Number of characters in the current string value length Car contains 3 characters.
Maximum number of characters allowed by a string attribute maxLength Use the attribute's maximum length when you need to cut text before saving it.

Related string and collection operators

Size also returns the number of characters composing a string. For collections, use the operator documentation appropriate to the value you are evaluating; isEmpty tests whether a collection is empty rather than measuring its character count.

See also