• Home
  • Observe and explore
  • Query data
  • Dynatrace Pattern Language
  • DPL Enum

Enum

ENUM { string=integer , … }

Enum constructor allows matching for a set of predefined strings and converts them into respectively assigned integer values. The strings and respective integer values are declared as series of key-value pairs, separated by commas and enclosed in curly brackets.

output typequantifierconfiguration

integer

none

cis = true allows matching string values case insensitively. Default false.

locale = string specifying IETF BCP 47 language tag enclosed in single or double quotes (see the list here). The default locale is English.

charset = character set name enclosed in single or double quotes (for example charset="ISO-8859-1")

Example 23.

Suppose we have data with username, login result and comment fields:

plaintext
Alice;success;all good Bob;Wrong password;attempts left 2 Oscar;tech error; Mallory;;doodaloo

Pattern. Line 3 maps login result strings (case-insensitively) to integer values:

plaintext
LD:username ';' ENUM{''=-3, 'success'=0, 'Wrong password'=1, 'tech error'=2}(cis=true):result ';' LD*:comment EOL;

Result:

usernameresultcomment
Alice0all good
Bob1attempts left 2
Oscar2
Mallory-3doodaloo