Skip to main content

Enum Type Syntax

diagram The identifier after the colon references a definition in the enums or ratings section of risksheet.json, or a Polarion enumeration.

Column Type Comparison

Featureenum:IDrating:IDmultiEnum:ID
Selection modeSingle-selectSingle-selectMulti-select
Shows descriptions in dropdownNoYesNo
ID typeStringIntegerString
Typical use caseCategorical fieldsRisk assessment scales (S, O, D)Tags, multiple categories
Cell decorator comparisonCompare against enum IDCompare against integer IDSee Multi-Enum Columns
Use rating:ID for risk assessment scales (severity, occurrence, detection) where numeric IDs and descriptions in dropdowns are useful. Use enum:ID for categorical selections where simple name display is sufficient.

Enum Column Properties

NameTypeDefaultDescription
idstringAuto-generatedUnique column identifier
typestringNoneenum:ENUM_ID where ENUM_ID references the enumeration definition
headerstringNoneColumn header display text
bindingstringSame as idPolarion field binding
levelnumber1Hierarchical level
readOnlybooleanfalseControls editability. Optional for main row items; mandatory for upstream/downstream linked item columns
filterablebooleantrueAllows filtering by enum values
widthnumberSee applicationColumn width in pixels
The type:enum property is optional for main row item columns (Risksheet auto-detects from the Polarion field binding). However, it is mandatory for all upstream and downstream linked item columns. Omitting the type for linked items results in the column not rendering correctly.

Enum Definition in risksheet.json

Custom enumerations are defined in the enums section:
{
  "enums": {
    "brakeCategory": [
      { "id": "disc", "name": "Disc Brake" },
      { "id": "drum", "name": "Drum Brake" },
      { "id": "regen", "name": "Regenerative" }
    ]
  }
}
Each enum option supports:
PropertyTypeDescription
idstringInternal identifier used in data storage and cell decorator comparisons
namestringDisplay name shown in the dropdown
descriptionstringExtended description (shown in rating type dropdowns only)
iconstringIcon identifier for visual display

Rating Definition in risksheet.json

Rating enumerations are defined in the ratings section. The structure is identical to enums but ratings use integer IDs and display descriptions in dropdowns:
{
  "ratings": {
    "severity_scale": [
      { "id": 1, "name": "1", "description": "No effect" },
      { "id": 2, "name": "2", "description": "Minor annoyance" },
      { "id": 3, "name": "3", "description": "Moderate effect" },
      { "id": 5, "name": "5", "description": "Significant degradation" },
      { "id": 8, "name": "8", "description": "Safety risk with warning" },
      { "id": 10, "name": "10", "description": "Hazardous without warning" }
    ]
  }
}
Unlike regular enumerations which use string IDs, ratings use integers as IDs. This distinction is important when writing cell decorators or formulas that compare values.

Cell Decorators for Enum Columns

Cell decorators compare against enum IDs, not display values. This is a common source of errors.
{
  "cellDecorators": {
    "brakeStatus": "function(info){ var val = info.value; $(info.cell).toggleClass('approved', val === 'yes'); $(info.cell).toggleClass('pending', val === 'pending'); }"
  },
  "styles": {
    ".approved": "{background-color: #eaf5e9 !important; color: #1d5f20 !important;}",
    ".pending": "{background-color: #fff3d2 !important; color: #735602 !important;}"
  }
}
Cell decorator functions must compare against the enum ID (e.g., 'yes'), not the display value (e.g., 'Y'). Using display values causes the comparison to fail silently. CSS style definitions require !important to override Risksheet default styling.

Enum Loading and Filtering

Risksheet automatically loads enumeration values for dropdown columns:
  • Risk-type enums filter options by the configured risk work item types
  • Task-type enums filter options by the configured task types across multiple projects
  • Project enums show only projects allowed in the configuration
Polarion enumerations are loaded automatically even without explicit definitions in the enums section of risksheet.json. Custom enum definitions override or supplement Polarion-provided values.

WorkItem Enum Fields

WorkItem enum fields (custom fields that reference work items as enum values) require specific type syntax matching the Polarion XML custom field definition:
{ "id": "workpackage", "type": "multiEnum:@NoIDWorkItems[workpackage]", "header": "Work Package" }
WorkItem enum fields have limited support for upstream and downstream items compared to main row item properties. Check the Polarion custom field XML configuration (custom-fields.xml) for the exact enum definition name to use in the type property.

Dependent Enumerations

Dependent enumerations allow filtering available values in one column based on the selection in another column. This feature was released in version 25.3.1 for single-value enums. The relations section in risksheet.json defines dependent enum relationships:
{
  "relations": [
    {
      "source": "categoryEnum",
      "target": "subcategoryEnum",
      "mapping": "dependent"
    }
  ]
}
Dependent enumeration support was released in version 25.3.1 for single-value enums. Multi-value enum dependency (multiEnum) is planned for a future release. Verify available functionality in your Risksheet version.
Two dependency patterns exist:
PatternDescription
Tree-based (1:N)Each source value maps to a unique set of target values
MixedTarget values can be shared across multiple source values

PDF Export Behavior

Enum fields in PDF export have inconsistent rendering:
Field TypeExport Behavior
Regular enum columnsExported with display names (titles)
rating columnsExported with numeric IDs instead of display names
User reference columnsExported with user IDs instead of display names
Use saved views as an alternative export option to control how enum fields are rendered in PDF output. See Saved Views.

Complete Example

{
  "columns": [
    { "id": "title", "header": "Failure Mode", "binding": "title", "type": "string", "level": 1, "width": 250 },
    { "id": "severity", "header": "Severity (S)", "type": "rating:severity_scale", "level": 1, "width": 80 },
    { "id": "occurrence", "header": "Occurrence (O)", "type": "rating:occurrence_scale", "level": 1, "width": 80 },
    { "id": "detection", "header": "Detection (D)", "type": "rating:detection_scale", "level": 1, "width": 80 },
    { "id": "category", "header": "Category", "type": "enum:risk_category", "level": 1, "width": 120 },
    { "id": "measures", "header": "Measures", "type": "multiEnum:measure_types", "level": 1, "width": 180 }
  ],
  "enums": {
    "risk_category": [
      { "id": "design", "name": "Design" },
      { "id": "process", "name": "Process" },
      { "id": "material", "name": "Material" }
    ]
  },
  "ratings": {
    "severity_scale": [
      { "id": 1, "name": "1", "description": "No effect" },
      { "id": 4, "name": "4", "description": "Moderate" },
      { "id": 7, "name": "7", "description": "High" },
      { "id": 10, "name": "10", "description": "Hazardous" }
    ],
    "occurrence_scale": [
      { "id": 1, "name": "1", "description": "Remote" },
      { "id": 4, "name": "4", "description": "Low" },
      { "id": 7, "name": "7", "description": "Moderate" },
      { "id": 10, "name": "10", "description": "Very high" }
    ],
    "detection_scale": [
      { "id": 1, "name": "1", "description": "Almost certain" },
      { "id": 4, "name": "4", "description": "High" },
      { "id": 7, "name": "7", "description": "Low" },
      { "id": 10, "name": "10", "description": "Almost impossible" }
    ]
  },
  "cellDecorators": {
    "category": "function(info){ var val = info.value; $(info.cell).toggleClass('catDesign', val === 'design'); $(info.cell).toggleClass('catProcess', val === 'process'); }"
  },
  "styles": {
    ".catDesign": "{background-color: #e3f2fd !important; color: #1565c0 !important;}",
    ".catProcess": "{background-color: #fff3e0 !important; color: #e65100 !important;}"
  }
}

See Also

KB ArticlesSupport TicketsSource Code
  • AppConfig.ts
  • RisksheetViewServlet.java
  • GetSetUtil.java
  • AppConfigHelper.ts
  • ExportToExcel.ts