Skip to main content
Nextedy Velocity Macro
Renders a single system element row in DFMEA Coverage Gap Reports with failure mode counts, Action Priority distribution, and FMEA module association tracking.

Overview

The nxFmeaElementBlock macro generates one row in a hierarchical system element table, showing:
  • System element name and hierarchy level (System, Subsystem, Component)
  • Link to associated DFMEA (Design FMEA) module
  • Count of failure modes defined for this element
  • Distribution of Action Priority (AP) classifications: Low (L), Medium (M), High (H), Not Assigned (N/A)
  • Pre-mitigation and post-mitigation AP bucket counts for risk reduction tracking
This macro is used in the System DFMEA Report dashboard to build hierarchical coverage tables and track which system elements have documented FMEAs and which are missing analysis.
The macro is specifically designed for hierarchical DFMEA reporting where each system element (System → Subsystem → Component) requires a corresponding DFMEA module documenting failure modes and risk controls. It enables visual scanning of FMEA completeness and risk distribution across the system hierarchy.

Macro Signature

#macro(nxFmeaElementBlock $element $indentLevel $failureModeList $premitigationAPField $postmitigationAPField)

Parameters

NameTypeRequiredDescription
$elementWorkItemYesSystem element (type systemElement) to render in the table row
$indentLevelIntegerYesVisual indent level for hierarchy (0 = System, 1 = Subsystem, 2 = Component). Controls left margin and badge display.
$failureModeListCollectionYesCollection of failure mode work items (type failureMode) to analyze for this element. Typically pre-filtered to the element’s FMEA module via module field.
$premitigationAPFieldStringYesVelocity field name for pre-mitigation Action Priority (e.g., premitigationAP). Used to count pre-mitigation L/M/H distribution.
$postmitigationAPFieldStringYesVelocity field name for post-mitigation Action Priority (e.g., postmitigationAP). Used to count post-mitigation L/M/H distribution to show risk reduction.

Global Variables Set

The macro updates these global counters used by parent reports to track FMEA coverage:
VariableTypeDescription
$nxFmeaTotalIntegerIncremented by 1 for each system element processed (total elements in scope)
$nxFmeaExistingIntegerIncremented by 1 if element has at least one failure mode in $failureModeList (elements with FMEA analysis)
$nxFmeaMissingIntegerIncremented by 1 if element has zero failure modes (elements lacking FMEA analysis — coverage gap)

Rendered Output

The macro outputs a single HTML table row (<tr>) with the following cells:
| Indent + Element Badge | Element Name | FMEA Link | Total FM Count | Pre-Mit L | Pre-Mit M | Pre-Mit H | Pre-Mit N/A | Post-Mit L | Post-Mit M | Post-Mit H | Post-Mit N/A |

Output Structure

CellContentNotes
Hierarchy Indent + BadgeVisual indent (margin-left) + type badge (SYSTEM / SUBSYSTEM / COMPONENT)Indent level 0 = 0px, level 1 = 20px, level 2 = 40px. Badge color per element type.
Element Name$element.Title (e.g., “Power Management System”)Hyperlink to element work item in Polarion.
FMEA Module LinkHyperlink to associated DFMEA module or ⚠️ warning icon if missingMacro queries for riskSpecification module with systemElementId matching element; if not found, displays “FMEA Missing” alert and increments $nxFmeaMissing.
Total FM CountCount of items in $failureModeList for this elementSum of L + M + H + N/A in pre-mitigation column.
Pre-Mitigation L/M/H/N/AInteger counts per AP classificationCalculated by iterating $failureModeList and reading $element.{premitigationAPField}. Null or unrecognized values counted as N/A.
Post-Mitigation L/M/H/N/AInteger counts per AP classificationSame logic using $postmitigationAPField. Compares pre vs post to show risk reduction (e.g., 3 High → 1 High = effective mitigation).

Usage Example

## Initialize coverage counters at start of report
#set($nxFmeaTotal = 0)
#set($nxFmeaExisting = 0)
#set($nxFmeaMissing = 0)

## Query all system elements at hierarchy root
#set($systemElements = $p.getWorkItemsInCollection())

## Iterate system elements and render rows
#foreach($element in $systemElements)
  #if($element.Type == "systemElement" && $element.systemElementType == "System")
    
    ## Query failure modes for this element's DFMEA module
    #set($fmeaModule = $p.queryWorkItems("module:$element.systemElementId"))
    #set($failureModes = $p.queryWorkItems("type:failureMode AND module:$fmeaModule.Id"))
    
    ## Render element block row with counters
    #nxFmeaElementBlock($element 0 $failureModes "premitigationAP" "postmitigationAP")
    
    ## Recursively render subsystems
    #set($subsystems = $p.queryWorkItems("type:systemElement AND parent:$element.Id AND systemElementType:Subsystem"))
    #foreach($subsystem in $subsystems)
      #set($subFmeaModule = $p.queryWorkItems("module:$subsystem.systemElementId"))
      #set($subFailureModes = $p.queryWorkItems("type:failureMode AND module:$subFmeaModule.Id"))
      #nxFmeaElementBlock($subsystem 1 $subFailureModes "premitigationAP" "postmitigationAP")
    #end
  #end
#end

## Report coverage statistics after table
Coverage: $nxFmeaExisting of $nxFmeaTotal elements have FMEAs ($nxFmeaMissing missing)

How It Finds Associated FMEAs

The macro uses the module field on failure modes to associate them with system elements:
  1. Module Reference Model: Each failure mode work item has a module field pointing to its parent riskSpecification document (DFMEA)
  2. Element Matching: The DFMEA module is matched to a system element by comparing the module’s systemElementId custom field to the element’s ID
  3. Failure Mode Filtering: Only failure modes whose module.systemElementId matches the current element are counted
  4. Missing FMEA Detection: If no failure modes are found, the element is flagged as “missing FMEA” and a warning is displayed
The module field establishes the document-to-element relationship. When creating a new DFMEA for a subsystem, populate the module’s systemElementId field with the subsystem’s element ID. This enables the macro to automatically discover and link FMEAs.

Action Priority Bucketing Logic

The macro counts failure modes into AP categories using inline Velocity logic:
#foreach($fm in $failureModeList)
  #if($fm.{premitigationAPField} == "H")
    #set($premitH = $premitH + 1)
  #elseif($fm.{premitigationAPField} == "M")
    #set($premitM = $premitM + 1)
  #elseif($fm.{premitigationAPField} == "L")
    #set($premitL = $premitL + 1)
  #else
    #set($premitNA = $premitNA + 1)
  #end
#end

AP Values and Meanings

ValueMeaningAIAG-VDA Rule
HHigh Action PrioritySeverity ≥7 AND (Occurrence ≥6 OR Detection ≥7) — requires immediate mitigation
MMedium Action PrioritySeverity ≥4 AND medium occurrence/detection combinations — schedule for near-term resolution
LLow Action PrioritySeverity ≤6 AND low occurrence/detection — track but lower urgency
(null or other)Not Assigned (N/A)Missing S/O/D ratings or incomplete AP assessment

Risk Reduction Interpretation

Comparing pre-mitigation vs post-mitigation AP distributions reveals mitigation effectiveness:

Decision Matrix: When to Flag Elements

ConditionAlert LevelAction
Post-mitigation H count > 0Danger ⚠️Escalate to safety engineer; additional controls required
Post-mitigation M count > 0WarningReview controls; prioritize for next release
Post-mitigation L count = Total FM CountSuccess ✅All risks mitigated to acceptable level; close FMEA
Missing FMEA (failure mode count = 0)WarningSchedule DFMEA for this element; block release until complete

Integration with Parent Report

The System DFMEA Report typically:
  1. Initializes the three counters ($nxFmeaTotal, $nxFmeaExisting, $nxFmeaMissing) to zero
  2. Iterates all system elements in hierarchy order
  3. Calls #nxFmeaElementBlock() for each element, passing pre-filtered failure mode collections
  4. After the table, displays coverage metrics: nxFmeaExisting / nxFmeaTotal as a percentage bar
  5. Optionally displays a list of missing FMEAs (where $nxFmeaMissing > 0) with drill-down links to create FMEAs
MacroPurposeRelationship
nxCountByEnumGeneric enum aggregationAlternative approach for AP bucketing without indent/hierarchy
nxFindChildElementsHierarchical element traversalOften paired to iterate subsystems/components for recursive table building
nxAPBucketsAction Priority distribution (non-hierarchical)Simplified AP counting for flat failure mode lists without element context
nxCoverageBarVisual coverage progress barUsed after the element block table to render coverage percentage and gap indicator

Common Use Cases

DFMEA Completeness Check

Display all system elements and flag those without FMEAs:
#set($nxFmeaTotal = 0)
#set($nxFmeaExisting = 0)
#set($nxFmeaMissing = 0)

#foreach($element in $systemElements)
  #set($fms = $p.queryWorkItems("type:failureMode AND module.systemElementId:$element.Id"))
  #nxFmeaElementBlock($element 0 $fms "premitigationAP" "postmitigationAP")
#end

#if($nxFmeaMissing > 0)
  !!! warning "FMEA Coverage Gap"
      $nxFmeaMissing elements are missing DFMEA analysis. [Create FMEAs](/automotive/reference/guides/fmea/create-sfmea-document)
#end

Risk Reduction Tracking

Show pre vs post-mitigation risk distribution across the hierarchy to validate effectiveness of risk controls:
System Element Total FM Pre-L Pre-M Pre-H Post-L Post-M Post-H Status
Power Management (SYS) 15 3 6 6 8 5 2 ⚠️ Review
├─ Voltage Regulator 8 1 3 4 4 3 1 ⚠️ Review
└─ Battery Interface 7 2 3 5 4 2 1 ⚠️ Review
Rows with post-mitigation H > 0 need additional risk controls or design changes.

Hierarchical Navigation

Render the table with clickable element names linking to the Polarion Tracker, enabling navigation from high-level coverage view to detailed FMEA work items:
<a href="$p.getWorkItemTrackerUrl($element.Id)">$element.Title</a>

Troubleshooting

Missing FMEA Alert Displayed But FMEA Exists

Cause: The riskSpecification module’s systemElementId field does not match the system element ID. Resolution: Open the DFMEA module and verify systemElementId is set to the element’s ID (e.g., SYS-001). Update if incorrect.

AP Counts Show All “N/A”

Cause: Field name is incorrect or failure modes have null AP values. Resolution:
  1. Verify field names match work item schema: premitigationAP, postmitigationAP (case-sensitive)
  2. Open risksheet and assign S/O/D ratings to generate AP values
  3. Check that failure modes are scoped to the correct FMEA module via module field

Elements Show Zero Failure Modes

Cause: Failure mode collection is empty or module filter is not working. Resolution:
  1. In risksheet, create at least one failure mode for this element’s FMEA
  2. Ensure failure mode’s module field links to the element’s DFMEA document
  3. Verify element ID and FMEA module systemElementId match exactly

See Also