🚀 Welcome to MDriven Learn –  MDriven is now on Discord!  Don’t miss the latest Release Notes.
Enumerations
(Automatically adding template at the end of the page.)
(Adding message template to the top of the page)
Line 1: Line 1:
{{message|Write the content here to display this box}}
You can edit enumerations by right-clicking on any model element in the "model content" window.
You can edit enumerations by right-clicking on any model element in the "model content" window.
[[File:Edit enumerations menu.png|none|thumb|469x469px]]
[[File:Edit enumerations menu.png|none|thumb|469x469px]]

Revision as of 22:16, 16 June 2024

This page was created by Lars.olofsson on 2020-03-23. Last edited by Stephanie on 2025-02-11.

Write the content here to display this box

You can edit enumerations by right-clicking on any model element in the "model content" window.

Edit enumerations menu.png

The enumeration editing window:

Defining enumerations.png

The defined enumeration is a class in the model's type system.

For example, you can return a list of the values. This returns a collection of ImportColumn Tuples.

ImportColumn.allInstances

Convert this to a list of strings for each Enum value (for example to be used in a list on screen):

ImportColumn.allInstances.asString
Select an Enum value from the list, then get the string value from that:
ImportColumn.allInstances->select(ic|ic = #JournalName).asString
Get the value of an Enum tuple:
(#JournalName).toString

(note: asString does not work on Enum tuples)

Checking if a collection includes a value

You can't use the includes operator on collections of Enum. You have to select the value and check if you get a "hit".

This works:

SysSingleton.SO.ActiveUser.UserModes->select(x|x = #Consultant)->notEmpty

This does not work: SysSingleton.SO.ActiveUser.UserModes->includes(#Consultant)

MDriven Chat

How would you like to chat today?

Setting up your conversation


This may take a few moments