Skip to main content

Prerequisites

  • A domain model with entity types and constraints configured
  • A sheet configuration with at least one data source
  • A Polarion LiveDoc containing the work items you want to filter

Step 1: Understand Document Constraint Scoping

Powersheet can automatically scope queries to the current document. This happens through the constraints section of your domain model, which defines how entity types relate to documents. diagram

Step 2: Add Load Constraints to Your Entity Type

In your domain model YAML, add a constraints block with a load section that defines document filtering criteria:
domainModelTypes:
  SystemRequirement:
    polarionType: systemRequirement
    constraints:
      load:
        document:
          moduleFolder: Requirements
          moduleName: System-Requirements
    properties:
      title:
        type: string
This restricts the SystemRequirement entity to only load items from the document at Requirements/System-Requirements.

Step 3: Use Dynamic Document Constraints

For more flexible filtering, use $context.source.document to dynamically reference the current document:
domainModelTypes:
  SystemRequirement:
    polarionType: systemRequirement
    constraints:
      load:
        document:
          moduleFolder: $context.source.document.moduleFolder
          moduleName: $context.source.document.moduleName
    properties:
      title:
        type: string
Using $context.source.document allows a single domain model to work across multiple documents without hardcoding paths. The current document path is resolved at runtime.

Step 4: Filter by Document Type

You can also constrain entity loading by document type:
domainModelTypes:
  Hazard:
    polarionType: hazard
    constraints:
      load:
        document:
          type: riskAnalysis
This loads only Hazard work items from documents whose Polarion type is riskAnalysis.

Step 5: Apply Document Constraints to Picker Filters

When creating links between entities, you may want the picker dropdown to show only items from specific documents. Use pick constraints:
domainModelTypes:
  DesignRequirement:
    polarionType: designRequirement
    constraints:
      pick:
        document:
          moduleName: Categorized
load constraints filter what appears in the sheet. pick constraints filter what appears in the dropdown picker when selecting linked items. Mixing them up can cause items to appear in the picker but not in the sheet, or vice versa.

Step 6: Combine Document and Type Constraints

For precise scoping, combine document constraints with the allowedWITypes property:
domainModelTypes:
  Requirement:
    polarionType:
      - sys_req
      - des_req
    constraints:
      load:
        document:
          allowedWITypes: $context.source.type
      create:
        document:
          moduleFolder: $context.source.document.moduleFolder
          moduleName: $context.source.document.moduleName
The allowedWITypes property enables document-based routing of entities when multiple work item types map to a single entity type. Verify the exact behavior for your configuration.

Verify

After applying document constraints:
  1. Open the powersheet document in Polarion
  2. You should now see only work items that match the document filter criteria
  3. If using picker constraints, click a relationship cell and confirm the dropdown only shows items from the constrained documents
  4. Items from other documents should not appear in the sheet

See Also

KB ArticlesSource Code
  • PolarionQueryProcessor.java
  • QueryFactory.java
  • prod-powersheet-src/com.nextedy.powersheet.client/src/modules/ModelProvider/ModelProvider.tsx
  • prod-powersheet-src/com.nextedy.powersheet.client/src/modules/QueryManager/QueryManager.tsx
  • prod-powersheet-src/com.nextedy.powersheet.client/cypress/fixtures/models/constraints-base.yaml