nxDocInventoryTree is a Nextedy Solutions Velocity macro that generates a complete hierarchical document inventory table for a workspace, showing the system element tree with associated documents, type badges, status indicators, item counts, and tool links.
This macro is the foundational navigator component used across all TestAuto2 dashboard spaces (Requirements, Design, Risks, Testing) to provide users with a unified view of documentation structure organized by system element hierarchy.
Overview
The macro serves as an all-in-one document discovery and navigation interface that:
- Loads all system elements from the project hierarchy
- Filters documents to a specific workspace (space)
- Renders element headers with type badges (SYSTEM, SUBSYSTEM, COMPONENT)
- Displays document rows with type badges, status, work item counts
- Auto-detects Risksheet (DFMEA/PFMEA/HARA) vs PowerSheet (Characteristics/Functions) vs generic documents
- Provides direct tool links to open documents in Risksheet or Polarion tracker
- Supports optional system-element-based grouping for hierarchical display
Macro Signature
| Parameter | Type | Default | Description |
|---|
$workspaceFilter | String | (required) | Space key or name to filter documents (e.g., ‘Requirements’, ‘Risks’, ‘Design’, ‘Testing’) |
$columnLabel | String | ’Document’ | Header text for the hierarchy column (e.g., ‘System Element / Document’, ‘Module’) |
$groupBySystemElement | Boolean | false | If true, organizes documents by system element tree; if false, flat list per space |
Output Variables
| Variable | Type | Description |
|---|
$nxDocInventory | Map | LinkedHashMap keyed by system element ID, values are document lists per element |
$nxDocCount | Integer | Total document count in filtered workspace |
$nxElementCount | Integer | Total system element count with documents |
Rendered Table Structure
The macro produces an HTML table with the following columns:
| Column | Content | Example |
|---|
| Hierarchy | System element name with type badge (SYSTEM/SUBSYSTEM/COMPONENT) or document name | [SYSTEM] AEB System or System DFMEA Report |
| Type Badge | Small colored label indicating document type (RISKSHEET, POWERSHEET, REPORT, WIKI) | RISKSHEET (orange), POWERSHEET (blue) |
| Status | Document workflow state or work item counts | Draft, In Review, Published, 25 items |
| Count | Number of work items or sub-elements | 36 FM, 5 docs, 10 controls |
| Tool Link | Icon-button to open document in Risksheet or Tracker | Edit in Risksheet |
Workspace Filters
The macro works with any Polarion project space. Common TestAuto2 uses:
| Space Filter | Purpose | Typical Documents |
|---|
Requirements | Customer/System/Design requirements documents | Requirements RTM, System Specifications |
Design | Design artifacts and characteristics | Characteristics sheets, Functions, Design Verification |
Risks | Risk analysis and FMEA documents | HAZID, DFMEA, PFMEA, Control Plan, Risk Controls |
Testing | Verification and validation test documents | Test Cases, Validation Tests, V&V Reports |
Usage Examples
Basic Usage: Flat Document List
#nxDocInventoryTree("Requirements" "Document" false)
Produces a flat table of all documents in the Requirements space, sorted by document name.
Output:
| System Element / Document | Type | Status | Count | Tool |
|------------------------------------|--------------|-----------|--------------|------|
| System Requirements Specification | POWERSHEET | Published | 31 items | ✎ |
| CUS-REQ-001 Analysis | WIKI | Draft | 5 items | ✎ |
| System Design Report | DOCUMENT | Approved | 12 items | ✎ |
Hierarchical Usage: Grouped by System Element
#nxDocInventoryTree("Risks" "System Element / Document" true)
Produces a nested tree where each system element (System → Subsystem → Component) is a row, followed by child documents associated with that element.
Output:
| System Element / Document | Type | Status | Count | Tool |
|---|
| -------------------------------------------------- | ------------ | ----------- | ------------ | ------ |
| [SYSTEM] AEB System | — | — | 8 docs | — |
| ├─ System SFMEA | RISKSHEET | Published | 36 FM | ✎ |
| ├─ HARA Analysis | RISKSHEET | Approved | 23 hazards | ✎ |
| └─ Risk Control Plan | RISKSHEET | Draft | 218 items | ✎ |
| [SUBSYSTEM] ECU Processing Subsystem | — | — | 3 docs | — |
| ├─ Subsystem SFMEA | RISKSHEET | Published | 42 FM | ✎ |
| ├─ Design Characteristics | POWERSHEET | Published | 24 items | ✎ |
| └─ Functions | POWERSHEET | Published | 8 items | ✎ |
| [COMPONENT] System-on-Chip (SoC) | — | — | 2 docs | — |
| ├─ Component DFMEA | RISKSHEET | In Review | 22 FM | ✎ |
| └─ Design Characteristics | POWERSHEET | Published | 6 items | ✎ |
Requirements Space Example
#nxDocInventoryTree("Requirements" "Document" false)
Typical output for the Requirements dashboard:
Document Type Detection
The macro auto-detects document types based on naming convention and configuration:
| Detection Pattern | Document Type | Icon | Color |
|---|
| Contains ‘FMEA’ or ‘HARA’ or ‘Risk’ in name | RISKSHEET | | Orange |
| Contains ‘RTM’ or ‘Characteristics’ or ‘Functions’ | POWERSHEET | | Blue |
| Contains ‘Report’ or ‘Traceability’ or ‘Coverage’ | REPORT | | Green |
| Default (wiki pages, generic documents) | WIKI | 📄 | Gray |
System Element Hierarchy
When $groupBySystemElement = true, the macro traverses the project’s system element tree:
- project.systemElements (filtered by Type = “System”)
- systemElements (Type = “Subsystem”)
- systemElements (Type = “Component”)
- associated documents
- failure modes, characteristics, functions
- associated documents
- associated documents
Each level is indented and prefixed with element count and type badge.
Integration with Other Macros
nxDocInventoryTree typically works alongside:
| Macro | Purpose | Integration |
|---|
nxLinkCoverage | Traceability coverage | Both appear on space dashboard below doc inventory |
nxStatCount | Work item type statistics | Statistics bar above doc inventory |
nxCoverageBar | Gap visualization | Linked from doc inventory gaps |
nxFmeaElementBlock | FMEA-specific rows | Called per element in Risks space variant |
Standard dashboard structure: (1) Space banner + statistics bar → (2) Document inventory tree → (3) Traceability coverage bars → (4) Report quick-links
Common Customizations
Filter by Document Status
#set($statusFilter = "Published")
#nxDocInventoryTree("Requirements" "Document" false)
## Then filter rendered rows to show only $statusFilter
Custom Column Headers
#nxDocInventoryTree("Design" "Design Element / Artifact" true)
Two-Column Grid Layout
For dashboard space optimization, render two doc inventory tables side-by-side:
<div style="display: grid; grid-template-columns: 1fr 1fr; gap: 20px;">
<div>
## Requirements space inventory
#nxDocInventoryTree("Requirements" "Document" false)
</div>
<div>
## Design space inventory
#nxDocInventoryTree("Design" "Document" false)
</div>
</div>
For projects with 50+ documents, the macro may take 2–5 seconds to render. Consider:
- Caching the rendered output if the page is accessed frequently
- Using
$groupBySystemElement = false (flat list) for faster initial render
- Filtering to specific spaces to reduce document count
Troubleshooting
| Problem | Cause | Solution |
|---|
| Empty table | Space filter name doesn’t match | Verify space name matches Polarion project space exactly (case-sensitive) |
| Missing documents | Documents not in specified space | Check document location in Polarion; move to correct space if needed |
| Performance slow | Large document count or complex hierarchy | Switch to flat mode (false), reduce time range, or cache output |
| Type badges not displaying | CSS not loaded | Ensure nxCommonStyles macro runs before nxDocInventoryTree |
| Links broken | Document ID changed or moved | Re-render dashboard to refresh cached document references |