Enumeration

Last update: Edit

1 Introduction

This document describes an enumeration in Mendix Studio. An enumeration is a list of one or more items (values). Each item represents one option. For example, a customer can be assigned a Bronze, Silver, and Gold grade. So, the Customer Grade is an enumeration, while Bronze, Silver, and Gold are enumeration items. For more information on items, see the Enumeration Items section.

When you create an attribute of enumeration type you either assign an existing enumeration to it or create a new one. For details on properties of attributes of the enumeration type, see the Attribute Properties section in Attributes.

2 Enumeration Items

An enumeration consists of enumeration items or values. Each item represents one of the options.

The enumeration can also represent an uninitialized state. For example, if you do not assign any grade to a customer, the grade status is empty.

3 Basic Actions

An enumeration is configured when you add an attribute of the enumeration type to your domain model. You can either create a new one or select an existing enumeration.

3.1 Creating a New Enumeration

To create a new enumeration, do the following:

  1. Open your domain model.

  2. Select an entity you want to create the attribute for. For more information on how to create the entity, see section 3 Adding New Entities in Domain Models Overview.

  3. To create a new attribute of the enumeration type, click New attribute and do the following:
    a. Set the attribute Name. In our example, the name of the attribute is Grade.
    b. Set the Type to Enumeration.
    c. Click Select enumeration to create a new enumeration.
    d. In the Select enumeration dialog box, click New.
    e. In the Create new enumeration dialog box, click Add Item to add possible options of the enumeration (Name is filled out automatically and is the same as the attribute name).


    f. Fill out the name for the Caption (Name is filled out automatically). In our example, we first fill out Bronze, as one of three possible items of the enumeration: Bronze, Silver, and Gold.


    g. Click Add Item and repeat the step above to create other enumeration items.
    h. Click Create to close the dialog boxs and create the new attribute.

The attribute and the enumeration items are created.

3.2 Selecting an Enumeration

You can also set an existing enumeration for attributes of the enumeration type. Do the following:

  1. Open your domain model.

  2. Select an entity you want to create the attribute for. For more information on how to create the entity, see section 3 Adding New Entities in Domain Models Overview.

  3. To create a new attribute of the enumeration type, click New attribute and do the following:

    a. Set the attribute Name. In our example, the name of the attribute is Grade.
    b. Set the Type to Enumeration.
    c. Click Select enumeration to create a new enumeration.


    d. In the Select enumeration dialog box, the existing enumerations are displayed in the list. Click the one you want to use, then click Select.

The existing enumeration is selected for the attribute of the enumeration type.

3.3 Copying and Pasting an Enumeration

You can copy and paste an enumeration to another Studio app. Follow the steps below:

  1. Open your domain model.

  2. Select the attribute of the enumeration type and click Enumeration in its properties.

  3. In the Select Enumeration dialog box, select the enumeration you would like to copy and click the ellipsis icon.

  4. Select the Copy to clipboard option in the drop-down menu. Copy Enumeration

  5. Open a different module or Studio app, navigate to a domain model and press Ctrl + V.

The enumeration is pasted. For more information on copy/paste function in Studio, see the Copy/Paste Pages, Microflows, and Enumerations section in General Info.

3.4 Duplicating an Enumeration

To duplicate an enumeration, follow the steps below:

  1. Open your domain model.

  2. Select the attribute of the enumeration type and click Enumeration in its properties.

  3. In the Select Enumeration dialog box, select the enumeration you would like to duplicate and click the ellipsis icon.

  4. Select the Duplicate option in the drop-down menu.

    Duplicate Enumeration

The enumeration is duplicated.

4 Read More