Enumerations
Enumerations in XenoGuard are beneficial for assigning symbolic names to constant values, enhancing workflow readability and reducing errors by using clear names instead of hard-coded numbers or values.Centralizing changes to these values aids in maintainability. XenoGuard supports both local and global enumerations, with values always being of the text type, allowing for non-numeric values as well.
The following example demonstrates defining symbolic identifiers from Monday to Sunday for weekdays 1 to 7:
You can specifically access individual elements of an enumeration, for example, for assignments and comparisons. In our example, the value Friday is assigned to the variable My day. The If/Else action then performs a comparison.
Editing Enum Values
After adding a new Define Enum action to your script, the enumeration starts as empty. To add new values, click on the Value parameter. Small buttons will appear to the right. Click on the plus symbol to create a new entry. Each entry must have a unique key and a corresponding value.
Deleting or Reordering Individual Enum Values
Individual elements of an enum can be deleted at any time, and you can also change the order of elements in the list. When you select an individual list entry, various buttons appear to the right.
Button | Key Combination | Description |
---|---|---|
INS | Add new line | |
DEL | Delete line | |
SHIFT+UP | Move row up | |
SHIFT+DOWN | Move row down |
The next illustration shows the four buttons to the right of the third entry Wednesday:
Importing List Elements
Importing values for an enumeration from a text file containing all key/value pairs is often useful. Click on the second button next to Value to do this.
The following is an example of a valid text file:
Tuesday;2
Wednesday;3
Thursday;4
Friday;5
Saturday;6
Sunday;7
Here, the key and value are separated by a semicolon, and the entries are listed line by line.
Copying List Elements to the Clipboard
Click on the third button next to Value to copy all entries of an enumeration to the clipboard.