Add formula-driven columns to your Risksheet that automatically compute values from other cells, such as Risk Priority Numbers (RPN), weighted scores, and aggregated data from linked items.
Open your risksheet.json and add a named formula to the top-level formulas object. Each formula is a JavaScript function that receives an info parameter containing the current row data.
{ "formulas": { "commonRpn": "function(info){ var value = info.item['occ']*info.item['det']*info.item['sev']; return value?value:null;}" }}
The info object provides access to:
Property
Description
info.item
The current row’s data object, keyed by column id / binding
info.item['<binding>']
Value of any column in the same row (use the column id as the key)
Always return null when source values are missing or zero to prevent displaying misleading results. The pattern return value ? value : null; ensures blank cells instead of zeros when inputs are incomplete.
Name of the formula defined in the formulas object
readOnly
false (auto-set to true)
Automatically becomes read-only when formula is set
type
auto-detected
Data type inferred from binding; override explicitly if needed
width
auto
Column width in pixels
header
column id
Display text shown in the column header
level
1
Hierarchical level at which the column appears
filterable
true
Controls whether users can filter by this column’s values
cellRenderer
none
Optional custom cell renderer function name
When you set the formula property on a column, Risksheet automatically sets readOnly to true. You do not need to (and should not) manually set readOnly for formula columns. This prevents users from overwriting computed values.
RPN Calculation (Severity x Occurrence x Detection)
The standard Risk Priority Number formula multiplies three rating values. Most FMEA workflows require both an initial RPN and a revised RPN (after mitigations):
{ "formulas": { "commonRpn": "function(info){ var value = info.item['occ']*info.item['det']*info.item['sev']; return value?value:null;}", "commonRpnNew": "function(info){ var value = info.item['occNew']*info.item['detNew']*info.item['sevNew']; return value?value:null; }" }}
You can build formulas that concatenate or transform values from linked upstream items. For example, to combine an ID and title into a single display value:
{ "formulas": { "combinedIdTitle": "function(info){ var id = info.item['linkedItemId']; var title = info.item['linkedItemTitle']; return id && title ? id + ' - ' + title : (id || title || null); }" }}
Since version 24.9.1, the risksheet.ds.getMasterRowsByColumnValue() function enables aggregating data from downstream risk items into a parent row. This is critical for FMEA workflows where a process step needs to summarize characteristics from its child risk items — for example, collecting unique enum values from multiple risks or summing numeric fields across related items. Formulas using this function can also be written in the risksheetTopPanel.vm file using JavaScript.
Conditional Column Editability via Formulas and Cell Decorators
You can use the systemReadOnlyFields pattern with cellDecorators to conditionally toggle column editability based on enum values. For example, to make a column read-only when a status enum is set to “approved”:
Enterprise FMEA/HARA implementations often require conditional field editability based on enum values (for example, making risk evaluation criteria read-only after approval). Test the systemReadOnlyFields approach thoroughly in your environment, as it interacts with both column-level and item-level permission settings.
Step 4: Add Conditional Formatting to Calculated Columns
Pair your calculated columns with cellDecorators and styles for visual risk indicators. This creates color-coded cells based on the computed value:
{ "cellDecorators": { "rpn": "function(info){ var val = info.value; $(info.cell).toggleClass('boldCol', true ); $(info.cell).toggleClass('rpn1', val>0 && val <= 150 ); $(info.cell).toggleClass('rpn2', val > 150 && val <= 350); $(info.cell).toggleClass('rpn3', val > 350);}" }, "styles": { ".boldCol": "font-weight:600;", ".rpn1": "background-color: #eaf5e9 !important;color: #1d5f20 !important;", ".rpn2": "background-color: #fff3d2 !important; color: #735602 !important;", ".rpn3": "background-color: #f8eae7 !important;color: #ab1c00 !important;" }}
The decorator function receives info.value (the computed formula result) and info.cell (the DOM element), allowing you to toggle CSS classes based on thresholds:
Step 5: Apply Formula-Based Styling to Row Headers
You can also apply formula-based conditional formatting to row headers using the headers.rowHeader.renderer property. This colors the entire row header based on a data value, providing an at-a-glance risk indicator:
{ "headers": { "rowHeader": { "renderer": "rowHeaderRpnNew" } }, "cellDecorators": { "rowHeaderRpnNew": "function(info){ var val = info.item['rpnNew']; $(info.cell).toggleClass('rpn1', val>0 && val <= 150 ); $(info.cell).toggleClass('rpn2', val>0 && val > 150 && val <= 350); $(info.cell).toggleClass('rpn3', val>0 && val > 350);}" }}
This colors each row’s header cell based on the revised RPN value of that risk item. When scanning a large FMEA table, you can immediately spot high-risk rows by their red header cells.
If a formula column is hidden from the Risksheet view (via column visibility settings or saved views), its formula does not execute. This means any cell decorator or other column that depends on the hidden formula column’s value will show stale or incorrect data. If a title column uses a formula and is hidden during item creation, the resulting Polarion work item may have an incorrect title (just a number instead of the computed value). Keep formula columns visible during item creation, or use the Check stored formulas feature (available since v24.5.1) to reconcile stored values after the fact.
You should now see the calculated column displaying computed values automatically
Verify that the column is read-only — clicking a formula cell should not open an editor
Change a source value (for example, update a severity rating) and confirm the formula recalculates immediately
Check that cell decorators apply the correct color coding based on the formula result
After adding or modifying formulas, use the Check stored formulas feature to scan all rows and update any stored values that differ from the current formula result. This is especially important after changing formula logic on an existing Risksheet with historical data. The feature detects differences between the current formula result and the stored value, and marks affected items for update.