Role of Enums
Overview
An Enum or enumeration is a complete list of all the items in a collection. It is used to list options in the form of checkboxes, drop-downs, or radio buttons. So if a given value has a set of options, you use Enums to represent that in the flat file.
In ValueCore, Enums play a key role in defining a fixed set of named values that a variable can take. These named values represent specific, predefined options that a system can recognize, making it easier to enforce data consistency and improve readability. Enums help manage and organize values in a structured way, reducing the risk of errors that can come from using raw integers or strings. By using enums, developers can ensure that only valid, expected values are used in a system, improving code maintainability and clarity.
Enums could be added only to a flat file. If you have a generic file, upload the model and then add the Enums to the flat file that gets downloaded to your device.
Step-by-Step Guide
- While developing a Prototype, there may be instances when you need to provide options to the customers. In such a scenario, you need to add Enums.

-
Add a new sheet to the flat file immediately after VROI-INPUTS and VROI_OUTPUTS and name it VROI_ENUMS.

-
Enter the name of the Enum in the Name column.
-
Provide more details about the Enum in the Description column or leave it blank.
-
Enter the options in the Elements column.
-
Provide the numerical values that you assign to each element of Enum in the Values column. Refer to the Enum Model to clearly understand Enums.
- To make the options available to the customer, the particular Enum should be pulled in the VROI_INPUTS sheet. The options would be displayed either as a checkbox or drop-down on the Prototype page.
Note:
-
Usually, for two options a checkbox or radio button is used while for more than two options, a drop-down list is used.
-
To display Enum as a checkbox, ensure to add the format for the checkbox wherever Enum is referred to in the VROI_INPUTS sheet of the flattened file.
-
In the case of Generic files, if there is a checkbox/dropdown in the model, replace it with constant values and then upload. Later in the downloaded flattened file, create the VROI_ENUMS sheet, add Enums, and then pull the Enum values to the same variable to which we hardcoded the constant values during Generic upload.
- Include,1##Exclude,0 - Include/Exclude would appear as a dropdown option in the UI. Its value 1, 0 would be returned to VROI_INPUTS from VROI ENUMS, which is then used for VROI_OUTPUTS calculations in the flattened file.
Next - Role of VLOOKUP
