Formula Context Object
Every formula function receives a singleinfo parameter containing the following properties:
Formula Execution TimingFormulas are evaluated from the document’s data — when the document is opened or reloaded, when a row is created or edited, and when Check stored formulas runs — not during cell rendering. Since v26.7.1 a formula therefore runs whether or not its column is visible in the current view. When a formula result differs from the stored value, Risksheet can mark the item as edited; writing the result back to Polarion respects the
readOnly column setting.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
Since v26.7.1, formulas are evaluated from the document’s data rather than during cell rendering, so a formula runs whether or not its column is visible in the current view. The columns a formula reads may be hidden as well, and a formula that reads another formula’s column resolves correctly when both are hidden. Other formulas and cell decorators that depend on a hidden column therefore read its computed value, not a stale or null one. Any saved view is safe as the default view, including an export-only layout that hides every formula column.Storing a Value Has Different TriggersA calculated value reaches the bound Polarion field only for columns with
readOnly: false, and only when the document is saved — covering rows that were created or edited, or that Check stored formulas marked as drifted. Opening a document recalculates and displays values without writing them back. See Formulas and Column Visibility for the full rule and for the behavior on versions earlier than v26.7.1.Check Stored Formulas
Available since v24.5.1 When items are edited outside Risksheet (for example, through Polarion’s standard work item editor, an import, or the API), values stored in Polarion may drift from formula-calculated results. This action reconciles a whole document in one pass. To run it:- Open the Risksheet document. The action requires a clean starting point — save or discard any unsaved changes first.
- Navigate to Menu > Rows > Check stored formulas
- Risksheet recalculates every formula column for every row and marks each row whose stored value differs as changed
- Save the document — the save writes the corrected values to Polarion
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