🚀 Welcome to MDriven Learn –  MDriven is now on Discord!  Don’t miss the latest Release Notes.
OCLOperators classfromstring
Created by Hans.karlsen on 2024-09-24 · Last edited by Vale.buyondo on 2026-01-12.

The ClassFromString operator allows you to treat a string as a model type (OclType). When "going meta" with your model, you can use AsString to convert a type to a string, and ClassFromString to perform the inverse operation—converting that string back into an actionable type.

This is particularly useful when you need to query model metadata or filter subclasses based on naming conventions or tagged values stored as strings.

Syntax

string.ClassFromString

Example

Customer.allSubClasses->select(x|x.classfromstring.TaggedValue('status')<>'Obsolete')

This returns a collection of class strings where the actual underlying class does not have the "Obsolete" tag.

Documentation:ClassFromString