Custom formulas are defined in .polarion/nextedy/sheet-configurations/<document-type>-risksheet.json under the formulas array. Each Risksheet configuration (HARA, FMEA, PFMEA, Control Plan) can define its own formula set.
Example path for HARA Risksheet:
.polarion/nextedy/sheet-configurations/hara-risksheet.json
Navigate to this file using Polarion’s SVN browser or check out the project configuration to your local workspace.
Formulas consist of three components:
{
"id": "asilCalculation",
"expression": "calculateASIL(severity, exposure, controllability)",
"dependencies": ["severity", "exposure", "controllability"]
}
| Property | Purpose |
|---|
| id | Unique identifier referenced by column formulaId property |
| expression | JavaScript expression evaluated at runtime using field values |
| dependencies | Array of field IDs that trigger recalculation when changed |
The expression has access to all field values by their custom field ID. Use the exact field ID from .polarion/tracker/fields/custom-fields.xml, not the display label.
The ASIL formula implements ISO 26262 Table 4 risk classification logic:
{
"id": "asilCalculation",
"expression": "if (severity === 'S0' || exposure === 'E0' || controllability === 'C0') return 'QM'; if (severity === 'S1' && exposure === 'E1') return 'QM'; if (severity === 'S1' && exposure <= 'E2') return 'A'; if (severity === 'S1' && exposure === 'E3' && controllability <= 'C1') return 'A'; if (severity === 'S1') return 'B'; if (severity === 'S2' && exposure === 'E1' && controllability === 'C0') return 'QM'; if (severity === 'S2' && exposure === 'E1') return 'A'; if (severity === 'S2' && exposure === 'E2' && controllability <= 'C1') return 'A'; if (severity === 'S2' && exposure === 'E2') return 'B'; if (severity === 'S2' && exposure === 'E3' && controllability === 'C0') return 'A'; if (severity === 'S2' && exposure === 'E3' && controllability === 'C1') return 'B'; if (severity === 'S2') return 'C'; if (severity === 'S3' && exposure === 'E1' && controllability === 'C0') return 'A'; if (severity === 'S3' && exposure === 'E1') return 'B'; if (severity === 'S3' && exposure === 'E2' && controllability === 'C0') return 'B'; if (severity === 'S3' && exposure === 'E2') return 'C'; if (severity === 'S3' && exposure === 'E3' && controllability === 'C0') return 'C'; return 'D';",
"dependencies": ["severity", "exposure", "controllability"]
}
The Action Priority formula applies AIAG-VDA FMEA risk priority logic using Severity × Occurrence × Detection thresholds:
{
"id": "actionPriorityCalculation",
"expression": "var s = parseInt(fmSeverity) || 0; var o = parseInt(fmOccurrence) || 0; var d = parseInt(fmDetection) || 0; if (s >= 9 || (s >= 7 && o >= 4) || (s >= 5 && o >= 6 && d >= 5)) return 'H'; if (s >= 5 || (s >= 3 && o >= 5) || (o >= 7)) return 'M'; return 'L';",
"dependencies": ["fmSeverity", "fmOccurrence", "fmDetection"]
}
Formula Logic:
| Priority | Condition |
|---|
| HIGH | Severity >= 9 (catastrophic) |
| HIGH | Severity >= 7 AND Occurrence >= 4 |
| HIGH | Severity >= 5 AND Occurrence >= 6 AND Detection >= 5 |
| MEDIUM | Severity >= 5 (moderate impact) |
| MEDIUM | Severity >= 3 AND Occurrence >= 5 |
| MEDIUM | Occurrence >= 7 (very frequent) |
| LOW | All other combinations |
Configure Post-Mitigation Formulas
Track residual risk after control implementation:
{
"id": "postmitigationAPCalculation",
"expression": "var s = parseInt(fmSeverity) || 0; var o = parseInt(postmitigationFMOccurrence) || 0; var d = parseInt(postmitigationFMDetection) || 0; if (s >= 9 || (s >= 7 && o >= 4) || (s >= 5 && o >= 6 && d >= 5)) return 'H'; if (s >= 5 || (s >= 3 && o >= 5) || (o >= 7)) return 'M'; return 'L';",
"dependencies": ["fmSeverity", "postmitigationFMOccurrence", "postmitigationFMDetection"]
}
Note that post-mitigation formulas use postmitigationFMOccurrence and postmitigationFMDetection field IDs instead of the pre-mitigation variants. Severity typically remains constant.
After defining the formula, reference it in the column definition:
{
"id": "asil",
"caption": "ASIL",
"width": 80,
"dataType": "enum",
"enumId": "hara-asil",
"formulaId": "asilCalculation",
"cellDecoratorId": "asilTrafficLight"
}
The formulaId must match the formula’s id field exactly. The column will auto-populate when dependency fields change.
JavaScript syntax errors in formulas cause silent calculation failures. Use browser DevTools Console (F12) to debug. Look for FormulaEngine errors showing the failing expression and input values. Common mistakes: missing semicolons, unquoted string literals, undefined field references.
Create a test hazard or failure mode work item and manually vary the input fields (severity, exposure, controllability) through all combinations. Verify the calculated ASIL/AP matches ISO 26262 Table 4 or your custom risk matrix. Document edge cases (e.g., S0 always yields QM regardless of E/C).
Control Plan Risksheets can compute risk level from sample frequency and defect detection rate:
{
"id": "controlEffectivenessScore",
"expression": "var freq = parseInt(sampleFrequency) || 0; var detect = parseInt(detectionRating) || 0; return freq >= 100 && detect <= 3 ? 'High' : freq >= 50 && detect <= 5 ? 'Medium' : 'Low';",
"dependencies": ["sampleFrequency", "detectionRating"]
}
This example classifies control effectiveness based on sampling intensity and detection capability, useful for PFMEA control plan validation.
After saving the configuration:
- Open the Risksheet document in Polarion
- Navigate to a row with the calculated column
- Modify one of the dependency fields (e.g., change Severity from S1 to S2)
- The formula column should auto-update immediately
You should now see the calculated value update in real-time without manual data entry. The cell background color will reflect the traffic light decorator if configured.
See Also