Skip to main content

Formula Sections

Formula Syntax — Complete reference for formula structure, operators, and the parameter context object that provides access to row data Formula Functions — Built-in functions available within formulas including mathematical operations, string manipulation, date handling, and RISKSHEET-specific utilities Formula Examples — Working examples demonstrating common calculation patterns, conditional logic, and integration with FMEA/HARA workflows

Quick Start

Formulas are JavaScript functions defined in the formulas section of risksheet.json and applied to columns via the formula property:
{
  "formulas": {
    "rpn": "function(info) { return info.item['severity'] * info.item['occurrence'] * info.item['detection']; }"
  },
  "columns": [
    {
      "header": "RPN",
      "binding": "rpn",
      "type": "int",
      "formula": "rpn"
    }
  ]
}
Alternatively, store formula logic in the Top Panel for cleaner configuration:
{
  "formulas": {
    "rpn": "(info) => { return getRiskPriority(info); }"
  }
}
Then define getRiskPriority() in the Top Panel <script> section.

Key Concepts

Formula Execution — Formulas run automatically when the risksheet loads and whenever dependent cell values change. Results are displayed immediately in the grid. Read-Only by Default — Formula columns are automatically read-only since their values are computed, not user-entered. You can override this to store calculated results in Polarion custom fields. Context Parameter — All formulas receive an info object providing:
  • info.item — Object containing all row data (access via column binding: info.item['columnId'])
  • info.cell — HTML DOM element for the cell (used with cell decorators)
  • info.row — Row index in the grid
  • info.col — Column index in the grid
Return Value — Formulas should return a value matching the column type (number, string, date, etc.) or null for empty cells.

Common Patterns

Risk Priority Number (RPN)
info.item['severity'] * info.item['occurrence'] * info.item['detection']
Conditional Calculation
info.item['status'] === 'Open' ? info.item['effort'] : 0
String Concatenation
info.item['prefix'] + '-' + info.item['counter']
Fallback Values
info.item['custom_field'] || info.item['default_field'] || 'Unknown'

Integration with RISKSHEET

Formulas support all standard Nextedy RISKSHEET workflows:
  • FMEA Workflows — Calculate RPN, priority scores, and mitigation effectiveness
  • HARA Workflows — Compute risk levels based on severity and probability parameters
  • Risk Matrices — Display calculated risk levels in risk matrix visualizations
  • Export — Include formula results in Excel and PDF exports
  • Comparison — Track formula-driven changes when comparing document revisions

Formula Storage

Formulas are stored in two configurations:
ConfigurationLocationBest For
Inlinerisksheet.json formulas objectSimple calculations, single-line logic
Top PanelWiki page <script> sectionComplex logic, multiple formulas, code organization
Both approaches integrate seamlessly — reference the formula by name in column definitions.

Storing Calculated Values

By default, formula results are computed dynamically and not persisted to Polarion. To save calculated values:
  1. Create a custom field in Polarion Administration
  2. Set the column binding to match the custom field ID
  3. Set readOnly: false in the column configuration
  4. Make the field read-only in Polarion to prevent manual editing
This way, formulas calculate the value and RISKSHEET persists it to Polarion.
{
  "columns": [
    {
      "header": "RPN",
      "binding": "rpn",
      "type": "int",
      "formula": "rpn",
      "readOnly": false
    }
  ]
}

Troubleshooting

IssueCauseSolution
Formula returns undefinedReference column ID doesn’t match bindingUse correct column ID in info.item['columnId']
Formula returns 0 instead of nullMissing null checkReturn null explicitly for empty cells
Formula doesn’t recalculateDependency cell not changedEnsure formula references actual cell bindings
Export missing formula valuesColumn not included in export settingsCheck export visibility configuration
For detailed syntax reference, see Formula Syntax. For function library, see Formula Functions. For practical examples, see Formula Examples.
KB ArticlesSource Code
  • AppConfig.ts
  • AppConfigHelper.ts
  • risksheet.json
  • CellPreviewFormatter.ts
  • PolarionAppConfigManager.java