formulas.commonRpn = function(info) { var occ = info.item['occurrence']; // Occurrence rating (1-10) var sev = info.item['severity']; // Severity rating (1-10) var det = info.item['detection']; // Detection rating (1-10) var value = occ * sev * det; // Multiply all three factors return value ? value : null; // Return null if any factor is zero}
RPN Range: 1-1000 Risk Categories:
1-150: Low risk (green) — Monitor only
151-350: Medium risk (yellow) — Plan mitigations
351-1000: High risk (red) — Immediate action required
formulas.resource_priority = function(info) { var effort_hours = info.item['estimated_effort']; var team_capacity = info.item['team_hours_available']; var risk_score = info.item['rpn']; // Risk score weighted by effort requirements var priority = risk_score / (effort_hours + 1); // +1 to avoid division by zero return Math.round(priority);}
formulas.days_open = function(info) { var identified_date = new Date(info.item['identified_date']); var today = new Date(); if (!identified_date || isNaN(identified_date)) { return null; } var diff = today - identified_date; var days = Math.floor(diff / (1000 * 60 * 60 * 24)); // Convert ms to days return days >= 0 ? days : null;}
formulas.overdue_status = function(info) { var due_date = new Date(info.item['mitigation_due_date']); var today = new Date(); var status = info.item['status']; if (status == 'Completed' || status == 'Closed') { return null; // Not overdue if already completed } if (due_date < today) { var days = Math.floor((today - due_date) / (1000 * 60 * 60 * 24)); return days + ' days overdue'; } return null; // On track}
The formula framework treats null specially: it displays the cell as empty rather than showing “0” or “undefined”. This is essential for FMEA where a missing RPN component should not display as zero risk.
Copy
Ask AI
// Good: Returns null when data unavailableformulas.example_good = function(info) { if (!info.item['factor1'] || !info.item['factor2']) { return null; // Missing data → empty cell } return info.item['factor1'] * info.item['factor2'];}// Avoid: Returns 0 for missing dataformulas.example_bad = function(info) { return (info.item['factor1'] || 0) * (info.item['factor2'] || 0); // This masks incomplete data with zero values}