Get Enum Object
Introduction
The GETENUMOBJ function fetches the data from a mapped enumeration or enum type or object. After the GETENUMOBJ function fetches the data from the enum type, you can use it as follows:
- Displaying data in the drop-down and multi-select lists, check boxes, and other similar types of elements
- Storing the key/value pair in an entity after the end user selects a value of the related key in the element
Apart from these functional scenarios, you can use the enum data in several functional requirements. For instance, you can collaboratively use the GETENUMOBJ function to display an element (for example, a drop-down list or input field) or group of elements after the end user selects a value in the element (for example, a drop-down list, check boxes, tab, and others).
The following sections will describe the implementation of a functional scenario. In this functional scenario, the application will store the data in the entity after the user selects a value in the drop-down list.
Pre-requisite
To use the GETENUMOBJ function, you must have the following:
Application Page with Element
Assume you have an application page that contains a drop-down list named City. When a user clicks the City drop-down list to select a city, the application stores the selected city and its key in the entity.

Enumeration Type
After you design a page, you need to have an enum type. The GETENUMOBJ function will fetch all values from the enum type and then display them in the drop-down list. You can define the key/value pair in an enum type as follows:

Note:- To know more about creating an enum type, click here.
In the last screen capture, the enum type is Demo_enum. The data, 1, 2, and others are keys. The data, Ghaziabad, Faridabad, and others, are values of the related keys. When a user clicks the City drop-down list, the GETENUMOBJ function will fetch all values (for example, Faridabad and others) and then display them in the City drop-down list.
Entity
After you define an enum type, you need to create an entity and define its structure. In the entity, you define an object and two parameters. These parameters will store the key and its value after the user selects the same value in the drop-down list. You can define an entity as follows:

Note:- To know more about creating an entity, click here.
In the structure of the store_enum_data entity, store_enum is a JSON object. The code and value are attributes. When the end user clicks the City drop-down list and then selects a value (for example, Gurgaon), the implemented algorithm picks the selected value and its key from the mapped enum type and then stores them in the attributes of the selected entity.
You can map the enum type and entity when you implement the algorithm in the application. After you create and configure all items (enum type and entity) that you can use in implementing the algorithm with the GETENUMOBJ function, you need to create a task group. In the task group, you implement the algorithm by mapping the entity, enum, and the element.
The following section describes how to implement an algorithm with the use of the GETENUMOBJ function.
Concept
After you create the enum type and define the structure of an entity, you can implement the algorithm that contains the GETENUMOBJ function. To implement the algorithm, you need to create and configure a task group. In the task group, you define the condition by mapping the enum type, entity, and the element.
After you configure the task group, you can link the task group to the onSelect event in the drop-down element. To achieve this functionality, you can do the following:
Configuring a Task Group
To configure a task group:
- On the vDesigner module’s dashboard, see the left navigation panel.

- Put the mouse pointer on the left panel to expand it.
- In the left panel, click Task Groups to display the Task Groups page.
- On the Task Groups page, either click Create Task Group to create a new task group or double-click the name (for example, Getenum_Tskgp) of the existing task group to open the <<task group name >> page.
Note:- To know more about creating a new task group, click here.
- On the <<task group name >> page, in the Task tab, search and find the Copy Data task.

- After you find the Copy Data task, drag it to the Execution panel.
- Under Copy Data, in the Copy Data box, click the application tree icon(
) to display the Copy Data panel.
- In the Copy Data panel, click in the Copy From box to display the Search box and a group of tabs.

- In the group of tabs, scroll right and then click the Functions tab.
- In the Search box, enter getenumobj to display the GETENUMOBJ function.

- In the list, select the GETENUMOBJ function to display it with the path and code parameters.
- In the GETENUMOBJ function, click path to display the Search box and a group of tabs.
- In the group of tabs, click the Enum tab.

- In the Search box, enter demo_enum to display the Demo_enum enum type.

- In the GETENUMOBJ function, click code to display the Search box and a group of tabs.
- In the group of tabs, click the Element tab.
- In the Search box, enter the element’s reference name (for example, Dropdown_City) to map it to the enum type and entity.

- Click in the Copy To box to display the Search box and a group of tabs.
- In the group of tabs, click the Entity tab.
- In the Search box, enter the entity’s name to map it to the enum type and element.

Note:- If the list does not display the entity, it means the entity is not linked to the data model.
- After you select the entity’s name in the Copy To box, click Select in the Copy Data panel to configure the Getenum_Tskgp task group.

- In the <<task group name>> page, click Save to configure the task group.
After you configure the task group, you need to link the task group to the onSelect event of the City drop-down element.
Linking Task Group to Element
To link the task group to the element:
- On the application page, click the element (for example, the City drop-down list) to display the property panel.
- In the Dropdown property panel, see the Input Source area.
- In the Input Source area, click the Enumeration tab to display the Select Master list.
- Click the Select Master list and then select the enum type to fetch the data from it.

- After you select the enum type, click Apply to map the selected enum type to the City drop-down element.
- Scroll down the Dropdown panel, and then see the Events icon (
).

- Click the Events icon to display the onSelect event.
- Click the plus icon (
) to the right of the onSelect event to display the Event Configuration page.
- On the Event Configuration page, under Task Group, search and find the task group (for example, Getenum_Tskgp) that you want to map to the onSelect event.

- In the list of task groups, drag the task group ((for example, Getenum_Tskgp) to map it to the onSelect event of the City drop-down element.
- After you drag the task group, it displays the task or list of tasks that you configured under it.

- On the Event Configuration page, click Save to link the task group to the element (for example, the City drop-down list).
The End Result
After you link the task group to the element, you successfully impart the required functional behavior to the application by using the GETENUMOBJ function. When an end-user clicks the City drop-down list on the application page, the GETENUMOBJ function fetches all values (list of cities) from the Demo_enum enum type and then displays them to the end-user.
When the user selects a city (for example, Gurgaon) in the drop-down list, the implemented condition in the task group picks the value of the selected city and its key from the Demo_enum enum type and then stores the key in the code attribute and the city in the value attribute of the store_enum_data entity.

Examples and Use Cases
You can use the GETENUMOBJ function in the following use cases and scenarios:
- Displaying the list of similar types of items, such as a list of countries, states, counties, cities, and others.
- Storing the user-selection in the entity
- Displaying a list or a group of lists based on the user’s selection in the drop-down list (for instance:- the application displays the list of cities after the end-user selects a state in the parent drop-down list)
- Displaying a group of items in a drop-down list, multi-select list, group of check boxes, and others.
Best Practices
To use the GETENUMOBJ function smoothly during the application development in the vDesigner module, you are recommended the following set of best practices:
- Before you use the GETENUMOBJ function, create an enum type and entity and define their structures.
- Define the clutter-free structure of an entity based on the application’s functional requirements.
- After you create an entity, link it to the data model. If you do not link the entity to the data model, the Search box will not display the entity at the time you map it.