Enums Type Definitions

This page describes how to configure enum for enabling drop-downs.

Enums are custom types, used for enabling drop-downs in audience, triggers and action offers templates. Enum types are of two types i.e., Enum and TreeEnums. Enums are configured in file etc/model/campaigns/enum_type_definitions.json.

Enum

This Enum Types are simple one item selection type Enums.

Lets take example of an enum and how its configuration looks like:

"enums": [
    ...
    ...
    {
          "enumName": "SubscriberCategoryType",
          "placeholder": "Select subscriber category",
          "possibleValues": [
              {
                  "displayOrder": 0,
                  "displayValue": "Regular",
                  "intEnumValue": 0
              },
              {
                  "displayOrder": 1,
                  "displayValue": "Silver",
                  "intEnumValue": 1
              },
              {
                  "displayOrder": 2,
                  "displayValue": "Gold",
                  "intEnumValue": 2
              }
          ],
          "uelType": "Int32"
      },
      ...
      ...
  ]
  }

Above Enum is a configuration of Subscriber Category, there are 4 possible values for this Enum i.e., Regular, Silver and Gold. In the streaming data/Real data these different values are represented as ID field and value 0 denotes Regular, 1 denotes Silver and 2 denotes Gold. But on UI users will descriptive values like Gold, Regular.

  • enums is the type of enum being configured.
  • enumName is not name of enum to be used in various condition templates.
  • placeholder is the text to be show in place where selection is required on UI.
  • possibleValues are list of possible values for this enum.
  • displayOrder is order of this value in the drop-down.
  • displayValue is value to be show in the drop-down item.
  • intEnumValue or stringEnumValue or booleanEnumValue are the actual data value being selected.
  • uelType is the type of values.

When we use this enum type in a template condition then UI will look like below:

TreeEnums

TreeEnums are hierarchical enums and allows multi-select in the drop-down. Once we select from a TreeEnum a list of values are selected. If you select a leaf node of the tree then only single value will be selected, but if you select any other node except leaf node, then all leaf node under that will be selected.

Lets take example of DeviceType Enum as configured below:

..
..
{
    "enumName": "Devices",
    "placeholder": "Select device",
    "possibleValues": [
        {
            "children": [
                {
                    "children": [
                        {
                            "displayOrder": 0,
                            "displayValue": "Samsung Galaxy S5",
                            "enumValue": "GALAXY_S5"
                        },
                        {
                            "displayOrder": 1,
                            "displayValue": "Samsung Galaxy S6",
                            "enumValue": "GALAXY_S6"
                        },
                        {
                            "displayOrder": 2,
                            "displayValue": "Samsung Galaxy S7",
                            "enumValue": "GALAXY_S7"
                        }
                    ],
                    "displayOrder": 0,
                    "displayValue": "Samsung Galaxy",
                    "enumValue": "ALL_GALAXY_S"
                }
            ],
            "displayOrder": 0,
            "displayValue": "Samsung",
            "enumValue": "ALL_SAMSUNG"
        },
        {
            "children": [
                {
                    "children": [
                        {
                            "displayOrder": 0,
                            "displayValue": "iPhone 4",
                            "enumValue": "IPHONE4"
                        },
                        {
                            "displayOrder": 1,
                            "displayValue": "iPhone 5",
                            "enumValue": "IPHONE5"
                        },
                        {
                            "displayOrder": 2,
                            "displayValue": "iPhone 6",
                            "enumValue": "IPHONE6"
                        }
                    ],
                    "displayOrder": 0,
                    "displayValue": "iPhone",
                    "enumValue": "ALL_APPLE_IPHONE"
                }
            ],
            "displayOrder": 1,
            "displayValue": "Apple",
            "enumValue": "ALL_APPLE"
        },
        {
            "displayOrder": 2,
            "displayValue": "Google",
            "enumValue": "ALL_GOOGLE"
        }
    ]
}
..
..

When we use this enum type in a template condition then UI will look like below:

Note: Enum type definitions are loaded in-memory every-time we restart the tomcat backend.

Dynamic Enum

Dynamic enums are used to populate single-select drop-downs with values fetched from the backend. These values can come from different sources, including static definitions or dynamically loaded reference data sets. These reference data sets are periodically loaded into the system by the Detect backend.

Each reference data set has a configurable refresh period, defined in its corresponding schema.json file. This setup ensures that dropdown values stay current and reflect the latest available data.

Lets take example of dynamicEnum as configured below:

 "dynamicEnums": [
        {
            "enumName": "StaticSegment",
            "placeholder": "Select a static segment",
            "uelType": "String"
        },
       
{
            "enumName": "TowerType",
            "placeholder": "Select a tower type",
            "referenceProfileAttributeName": "towerType",
            "referenceProfileName": "Tower",
            "uelType": "String"
        },
        {
            "enumName": "InstalledPhoneApp",
            "placeholder": "Select a cell phone app",
            "referenceProfileAttributeName": "appName",
            "referenceProfileName": "PhoneApp",
            "uelType": "String"
        }

    ],
  • InstalledPhoneApp is a sample dynamic enum used for demonstration purposes.
  • StaticSegment is an existing dynamic enum that uses a static source.
  • TowerType: Dynamic enums backed by reference data sets. For more information on reference data sets, refer here. These use the following fields:
    • referenceProfileName: Specifies the profile name of the reference data set.
    • referenceProfileAttributeName: Identifies the attribute from the reference profile schema. The reference profile attribute name set contains duplicate entries. Detect will build a single drop-down list with only unique enum values.
Note: The number of values shown in a dynamic enum dropdown is limited by the maxLimitOfDynamicEnumValues setting in the drive.json file. By default, this limit is set to 10,000. To change the limit, update the value in drive.json and restart the Tomcat server for the changes to take effect.
Sample reference dataset for InstalledPhoneApp is shown below.
[
   [
       "Swiggy",
       "Swiggy food ordering app"
   ],
   [
       "Zomato",
       "Zomato food ordering app"
   ],
   [
       "Blinkit",
       "Blinkit , order anything app"
   ]
]

When we use this enum type in a template condition then UI will look like below: