Skip to main content

Define a Basic Source

The sources section is an array of data source definitions. Each source specifies a domain model reference, a query, and expansion paths:
sources:
  - model: rtm
    query:
      from: UserNeed
      where: <WHERE>
      take: <TAKE>
    expand:
      - name: systemRequirements
PropertyDescription
modelReference to the domain model that defines entity types and relationships
query.fromRoot entity type to query (must exist in the domain model)
query.whereFilter predicate — the <WHERE> placeholder is replaced at runtime
query.takeMaximum number of records — the <TAKE> placeholder is replaced at runtime
expandArray of expansion paths for loading related entities
The Model Helper widget visualizes the domain model structure and correct expansion paths. See Use Model Helper Widget for details.

Expand Relationships

The expand array defines which related entities are loaded alongside the root entity. Each entry uses the name property corresponding to a relationship in the domain model:
sources:
  - model: rtm
    query:
      from: UserNeed
      where: <WHERE>
      take: <TAKE>
    expand:
      - name: systemRequirements
        expand:
          - name: designRequirements
            expand:
              - name: verificationTestCases
              - name: externalReferences
Nested expand entries create multi-level hierarchies. The expansion path structure must match the relationships defined in your domain model. diagram
Begin with a single-level expansion and verify it loads correctly before adding deeper levels. Jumping straight to complex multi-level expansions leads to hard-to-diagnose errors.

Use a Dynamic Model Reference

Instead of hardcoding the model name, you can reference a runtime parameter using a JavaScript arrow function expression:
sources:
  - model: () => context.parameters.model
    query:
      from: UserNeed
      where: <WHERE>
      take: <TAKE>
    expand:
      - name: systemRequirements
The () => arrow function syntax is evaluated at runtime to resolve the model name from document parameters, enabling the same sheet configuration to work across different domain models.

Add Document Constraints

Use the constraints property to scope source data to the current Polarion document:
sources:
  - model: rtm
    query:
      from: UserNeed
      where: <WHERE>
    constraints:
      applyCurrentDocumentTo: UserNeed
    expand:
      - name: systemRequirements
The applyCurrentDocumentTo property filters the specified entity type to only include items from the current document context.

Verify

After saving the sheet configuration, reload the powersheet document. You should now see rows populated with data from the root entity type, with related entities expanded as columns according to your expansion paths.

See also

KB ArticlesSupport TicketsSource Code
  • prod-powersheet-src/com.nextedy.powersheet.client/cypress/fixtures/configurations/constraints_composing.template.yaml
  • prod-powersheet-src/com.nextedy.powersheet.client/cypress/fixtures/configurations/whole_rtm.template.yaml
  • prod-powersheet-src/com.nextedy.powersheet.client/src/modules/Powersheet/Powersheet.tsx
  • prod-powersheet-src/com.nextedy.powersheet/src/com/nextedy/powersheet/enumProvider/SheetConfigEnumProvider.java
  • prod-powersheet-src/com.nextedy.powersheet.client/cypress/fixtures/configurations/permissions-levels.template.yaml