Formula Context Object
Every formula function receives a singleinfo parameter containing the following properties:
Formulas execute during cell rendering. When a formula result differs from the stored value, Risksheet can mark the item as edited. Formula changes respect the
readOnly column setting. This means formulas only run when their column is visible in the current view.How Formulas Are Defined
Formulas are declared as named entries in the top-levelformulas object of sheet configuration. Each entry is a JavaScript function written as a string value:
formula property to the formula name:
Column Properties for Formula Columns
Data Access Functions
Direct Field Access
Access any field on the current work item using the column binding ID:Linked Item Field Access
For item link columns, the_link suffix provides the pre-rendered HTML hyperlink:
Built-In Formula Patterns
RPN Calculation (Initial Assessment)
The standard Risk Priority Number formula multiplies severity, occurrence, and detection ratings. This is the most common formula in FMEA configurations:
Return behavior: Returns the product of all three values. If any value is falsy (zero, null, or undefined), returns
null to avoid displaying zero for incomplete rows.
RPN Calculation (After Mitigations)
The revised RPN uses the post-mitigation rating fields to show the residual risk after corrective actions:Null-Safe Multiplication
Always guard against null inputs to avoidNaN results when data is incomplete:
Cross-Row Data Aggregation
getMasterRowsByColumnValue
Available since v24.9.1 Therisksheet.ds.getMasterRowsByColumnValue() function enables cross-row data aggregation. This is critical for FMEA workflows where parent process step rows need to summarize characteristics from child risk items.
Use case: Aggregate unique enum values from downstream risk items
In a process FMEA, the parent process step may need to collect all unique process characteristics from its child risk items:
String Functions
Field Concatenation
Combine multiple field values into a single display string:Auto-Generated Title
Automatically construct a title from component fields:Conditional Logic Functions
Risk Matrix Lookup
Implement a risk acceptance matrix using conditional logic:Enum-Based Conditional
Compare against enum IDs (not display names):Top Panel Function Integration
For complex calculations that exceed inline formula capacity, define functions in therisksheetTopPanel.vm file and call them from formulas. This pattern is also the only way to access document-level custom fields or external data sources.
Pattern Overview
The formula in sheet configuration calls a function defined inrisksheetTopPanel.vm:
risksheetTopPanel.vm:
Accessing Document Custom Fields via Top Panel
Document-level custom fields are not directly available in sheet configuration formulas. Access them via$doc.getOldApi().getValue('customFieldID') in the risksheetTopPanel.vm Velocity script section, then bridge the values into your formulas through global JavaScript functions:
Dynamic Risk Matrices from External Sources
Dynamic Risk Matrices from External Sources
The
risksheetTopPanel.vm can reference external data sources via Velocity context and Polarion APIs (e.g., reading risk acceptance matrix values from an XML sheet configuration). This enables dynamic risk matrix definitions shared across projects without duplicating formula logic in each sheet configuration.Accessing Work Item Data in Top Panel Functions
Work item data can be accessed in top panel functions viainfo.item['fieldId']. Prepare all needed values within functions defined in the top panel file, then return the result to sheet configuration formulas:
Formulas and Cell Decorators
Formulas compute the value; cell decorators apply visual styling based on that value. The two work together but are configured separately in sheet configuration.cellDecorators entry for RPN values applies CSS classes based on risk thresholds:
RPN Risk Threshold CSS Classes
Row Header Decorator
The row header can also display risk color based on the revised RPN value:Formula Visibility and Execution
Formulas execute during cell rendering, which means a formula only runs when its column is visible in the current view.Check Stored Formulas
Available since v24.5.1 When formula columns havereadOnly: false, or when items are edited outside Risksheet (for example, through Polarion’s standard work item editor), stored values may drift from formula-calculated results. To reconcile:
- Open the Risksheet document
- Navigate to Menu > Rows > Check stored formulas
- Risksheet recalculates all formula columns and flags any differences
Formula Return Types
Complete Example
A full FMEA configuration with initial and revised RPN formulas, cell decorators, row header styling, and corresponding CSS:Related Pages
- Formula Syntax — expression structure and operator reference
- Formula Examples — ready-to-use formula configurations for common scenarios
- Calculated Columns — column configuration for formula-driven columns
- Cell Decorators — visual formatting based on cell values
- Top Panel Template — defining JavaScript functions accessible from formulas
- Conditional Formatting — CSS style definitions for risk thresholds
- Configuration Properties Index — full property reference