Overview
The Nextedy Solutions macro library is stored in .polarion/pages/scripts/velocity/nextedy_solutions.vm and must be imported at the beginning of any Velocity template that uses Nextedy components. All macros are invoked within the Velocity engine context, making work item and document data available for rendering.
Nextedy macros execute within Polarion’s Velocity template engine and have access to $transaction API, $item (current work item), and $page (wiki page context). All macros assume these variables are available unless otherwise documented.
Macro Library Initialization
Every Velocity page using Nextedy macros must follow this initialization pattern:
#import velocity.macros.nextedy_solutions_vm
#nxInit()
#nxCommonStyles()
| Component | Purpose | Required |
|---|
| Import statement | Loads the nextedy_solutions.vm library | Yes |
#nxInit() | Initializes Nextedy context and variables | Yes |
#nxCommonStyles() | Injects CSS styles for Nextedy components | Yes |
Core UI Components
Space and Report Banners
Space banners provide consistent branded headers for dashboard pages. Used at the top of space home pages and reports to establish visual context and document purpose.
| Macro | Parameters | Output | Example |
|---|
#nxSpaceBanner() | spaceId (string), title (string), description (string), primaryColor (hex), secondaryColor (hex) | Full-width branded header banner | #nxSpaceBanner("Requirements", "Requirements", "System and Subsystem Requirements — Traceability and Coverage Dashboard", "#1565c0", "#0d47a1") |
#nxReportBanner() | title (string), description (string) | Report-specific banner (alternate styling) | #nxReportBanner("ISO 26262 HARA Report", "Hazard Analysis and Risk Assessment") |
Section Headers and Dividers
Section headers create visual breaks between logical sections within a dashboard or report, improving readability and navigation.
| Macro | Parameters | Output |
|---|
#nxSectionHeader() | title (string) | Styled section header divider with title text |
#nxSpaceFooter() | None | Closing footer component for space pages (pairs with #nxSpaceBanner) |
Usage Example:
#nxSectionHeader("Requirements Traceability Coverage")
Statistics and KPI Cards
Statistics cards display live counts and key performance indicators. Two card types serve different use cases: raw counts and percentage-based metrics.
| Macro | Parameters | Output | Styling |
|---|
#nxStatCard() | count (integer), label (string) | Card displaying a single count with label | Neutral styling |
#nxKpiCard() | value (string), label (string), tooltip (string), color (hex) | Card with value, label, and optional tooltip | Color-coded background |
#nxSummaryCardPct() | count (integer), label (string), percentage (integer), color (hex) | Card displaying count, label, and percentage with color | Color-coded percentage |
Card Grid Pattern:
#nxStatsGrid()
#nxStatCard(42, "Requirements")
#nxStatCard(38, "Verified")
#nxStatCard(4, "Gaps")
#nxStatsGridEnd()
Link Card Navigation
Link cards create clickable navigation cards for quick access to reports, PowerSheets, and risksheets. Cards can include icons and descriptions to guide users to the correct resource.
| Macro | Parameters | Output |
|---|
#nxLinkCard() | title (string), description (string), url (string), type (string: “report”, “powersheet”, “risksheet”) | Styled card with icon and clickable link |
#nxLinkCardsGrid() / #nxLinkCardsGridEnd() | None | Container for organizing multiple link cards in a grid |
Navigation Grid Example:
#nxLinkCardsGrid()
#nxLinkCard("Requirements Traceability Report", "V-model traceability matrix",
"/polarion/#/project/TestAuto2/wiki/Requirements Traceability Report", "report")
#nxLinkCard("Whole RTM Sheet", "Complete requirements to verification mapping",
"/polarion/#/project/TestAuto2/powersheet?document=Requirements%2FWhole RTM", "powersheet")
#nxLinkCardsGridEnd()
Data Aggregation Functions
Link Coverage Analysis
The link coverage function counts relationships between work item types and calculates coverage percentages. Essential for traceability compliance reporting.
| Function | Parameters | Sets Variable | Purpose |
|---|
#nxLinkCoverage() | sourceItems (collection), targetType (string), linkRole (string), direction (string: “forward” or “back”) | $nxLcCovered (integer), $nxLcTotal (integer) | Count items with specified link type and calculate coverage |
Usage Pattern for Traceability:
#set($allSysReqs = $transaction.workItems().search()
.query("project.id:TestAuto2 AND type:sysReq").items())
#nxLinkCoverage($allSysReqs, "testCase", "verifies", "back")
Verification Coverage: $nxLcCovered / $nxLcTotal items verified
Percentage Calculation
Calculates percentage from numerator and denominator, storing both string and integer representations for flexible rendering.
| Function | Parameters | Sets Variables | Purpose |
|---|
#nxPctCalc() | numerator (integer), denominator (integer) | $nxPct (string: “XX%”), $nxPctInt (integer: 0-100) | Convert count ratio to percentage |
Conditional Styling with Percentage:
#nxPctCalc($nxLcCovered, $nxLcTotal)
#if($nxPctInt >= 80)<span class="nx-cell-green">$nxPct</span>
#elseif($nxPctInt >= 50)<span class="nx-cell-yellow">$nxPct</span>
#else<span class="nx-cell-red">$nxPct</span>#end
Field Population Counting
Counts how many items in a collection have a specified field populated (non-empty), useful for data quality and readiness metrics.
| Function | Parameters | Sets Variable | Purpose |
|---|
#nxCountFieldPresent() | items (collection), fieldName (string) | $nxFieldPresentCount (integer) | Count items with field populated |
Readiness Metric Example:
#set($allFailureModes = $transaction.workItems().search()
.query("project.id:TestAuto2 AND type:failureMode").items())
#nxCountFieldPresent($allFailureModes, "postmitigationAP")
FMEA Coverage: $nxFieldPresentCount / {total failure modes} actions prioritized
Safety-Specific Macros
Risk Matrix Visualization
Renders a visual 5×4 risk matrix showing hazard distribution across Severity (rows) × Likelihood (columns) dimensions. Cells are color-coded based on calculated risk level (low=green, medium=orange, high=red, critical=dark red).
| Macro | Parameters | Output | Notes |
|---|
#nxRiskMatrix() | dataSource (work item collection), severityField (string), likelihoodField (string), riskLevelField (string) | Visual 5×4 matrix with color-coded cells and cell counts | Implements standard automotive risk mapping: S1+L1-4=low; S2+L1-2=low, L3-4=medium; S3+L1=low, L2-3=medium; S4+L1=medium minimum |
Risk Level Color Scheme:
Low (#4CAF50 — green) : Risk acceptable as-is
Medium (#FF9800 — orange) : Mitigation recommended
High (#ff5722 — red) : Mitigation required
Critical (#f44336 — dark) : Urgent mitigation needed
FMEA Element Block
Displays a formatted FMEA work item with severity, occurrence, detection, and action priority ratings in a structured card layout.
| Macro | Parameters | Output |
|---|
#nxFmeaElementBlock() | failureMode (work item), showPostMitigation (boolean) | Formatted card with severity/occurrence/detection/RPN ratings |
Traffic Light Legend
Visual legend showing color thresholds for compliance metrics. Typically placed near readiness matrices and coverage bars.
| Macro | Parameters | Output |
|---|
#nxTrafficLightLegend() | None | Color legend: Green >= 80%, Yellow 50-79%, Red < 50% |
Coverage Visualization
Coverage Bar
Renders a horizontal progress bar showing coverage percentage with optional drill-down query link. Color-coded based on threshold: green >= 80%, yellow 50-79%, red < 50%.
| Macro | Parameters | Output |
|---|
#nxCoverageBar() | covered (integer), total (integer), label (string), gapQuery (Lucene query string) | Progress bar with percentage, label, and clickable gap query link |
Traceability Coverage Example:
#nxLinkCoverage($allSysReqs, "testCase", "verifies", "back")
#nxCoverageBar($nxLcCovered, $nxLcTotal, "System Requirement Verification",
"type:sysReq AND NOT backlinkedWorkItems:verifies=TA*")
Document Inventory Tree
Displays a hierarchical tree of modules (documents) in a space, organized by custom structure field (typically system element hierarchy). Supports expansion/collapse and custom icons per level.
| Macro | Parameters | Output | Notes |
|---|
#nxDocInventoryTree() | spaceFilter (string), columnHeader (string), expandFirstLevel (boolean) | Hierarchical document tree with custom icons per level | Third parameter controls whether tree starts expanded |
Renders a standardized report header with project context and generation timestamp.
| Macro | Parameters | Output |
|---|
#nxDocHeaderGray() | title (string) | Gray header bar with title |
#nxDocInfoItem() | label (string), value (string) | Row item: “Label: Value” |
Report Header Pattern:
#nxDocHeaderGray("ISO 26262 HARA Report")
#nxDocInfoItem("Project", "TestAuto2 — Automotive Safety Solution")
#nxDocInfoItem("Generated", "$date.format('yyyy-MM-dd HH:mm')")
#nxDocInfoItem("Total Hazards", "$totalHazardCount")
Common Property Values
Card Type Enumeration
The type parameter in #nxLinkCard() accepts these predefined values:
"report" — Document/wiki page icon
"powersheet" — PowerSheet configuration icon
"risksheet" — Risksheet editor icon
Color Values
Macro color parameters accept standard hex color codes (#RRGGBB format):
#4CAF50 Green (low risk, on track)
#FF9800 Orange (medium risk, in progress)
#ff5722 Red-orange (high risk)
#f44336 Dark red (critical risk)
#1565c0 Primary blue
#0d47a1 Secondary dark blue
#c0392b Primary red (risks)
#922b21 Secondary dark red
Macro Workflow Diagram
Best Practices
Combine data functions (#nxLinkCoverage, #nxPctCalc) with UI components (#nxCoverageBar, #nxKpiCard) to create complete readiness and coverage displays. Always calculate metrics before rendering.
Velocity macro variables (like $nxLcCovered, $nxPct) exist only within macro scope. After calling a data function, immediately use its output variable before calling another macro. If you need to reuse a value across multiple sections, save it to a local variable first: #set($myCoverage = $nxLcCovered).
For large projects, query performance matters. Use specific field filters (e.g., type:sysReq AND status.KEY:active) rather than broad queries. Cache query results in variables to avoid re-executing the same query multiple times.