Getting Started: Sources Configuration

Modified on Wed, 18 Feb at 5:09 PM

Sources are the foundation of your Powersheet configuration. They define what data to load from Polarion and how to navigate relationships between different entity types. Think of sources as the blueprint for your data structure — they specify which entities to query, which related items to include, and how to organize the information in your sheet.


Sources configuration is part of Sheets configuration as described here.



TABLE OF CONTENTS



When to Use Sources


Use sources configuration when you need to:

  • Query entities from Polarion (requirements, test cases, hazards, etc.)
  • Navigate relationships between entities (e.g., show requirements linked to user needs)
  • Filter data based on specific criteria (e.g., only items from the current document)
  • Set default values for newly created entities
  • Create multi-level hierarchies in your sheet (parent-child relationships)



Basic Structure


Sources are defined in your Powersheet YAML configuration under the "sources" key as an array. Each source is a separate data query.

sources:
  - id: "my-source"
    title: User Needs
    model: rtm
    query:
      from: UserNeed
    expand:
      - name: systemRequirements
        expand:
          - name: systemRequirement



Source Properties

Required Properties


PropertyTypeDescriptionExample
queryObjectSpecifies what entities to loadSee Query Configuration
query.fromStringEntity type to query (from your domain model)UserNeed, SystemRequirement, Hazard


Optional Properties


PropertyTypeDescriptionExample
idStringUnique identifier for this sourcertm-source
titleStringDisplay name for the entity typeUser Needs
modelStringDomain model to usertm, riskmanagement
expandArrayRelated entities to includeSee Expand Configuration
entityFactoryObjectDefault values for new entities See Entity Factory



Query Configuration


The "query" object defines which entities to load from Polarion. It supports OData-style query syntax.


Basic Query

sources:
  - query:
      from: UserNeed


This loads all UserNeed entities from your project.


Query with Filtering

sources:
  - query:
      from: SystemRequirement
      where:
        status:
          in: ["draft", "approved"]


Query Properties


PropertyTypeDescriptionExample
fromStringRequired. Entity type to queryUserNeed, TestCase
whereObjectFilter conditions See examples below 
orderByArraySort order"title asc", "created desc"
takeNumberLimit number of results100
topNumberAlternative to "take"50


Where Conditions


The where: clause supports various operators:


Equal

where:

  status: "approved"


In (multiple values)

where:

  severity:

    in: ["high", "critical"]


Not equal

where:

  status:

    ne: "obsolete"


Greater than, less than

where:

  priority:

    gt: 3


Combining conditions (AND)

where:

  status: "approved"

  priority:

    gt: 2



Expand Configuration


The expand array lets you include related entities and navigate relationships. This is how you create multi-level sheets showing parent-child relationships.


Basic Expansion

sources:
  - query:
      from: UserNeed
    expand:
      - name: systemRequirements
        expand:
          - name: systemRequirement


This creates a sheet with:

- UserNeed (root level)

  - SystemRequirement (child level via "systemRequirements" relationship)


Expand Properties


PropertyTypeDescriptionExample
nameStringRequired. Navigation property name (from domain model)systemRequirements, chapter
titleStringDisplay name for the entity typeSystem Req.
expandArrayNested expansions (for deeper relationships) See examples
entityFactoryObjectDefault values for new entities at this levelstatus: "draft" 
queryObjectAdditional query for this expansionSee Query Configuration


Multi-Level Expansion


You can nest expansions to show multiple relationship levels:

sources:
  - query:
      from: UserNeed
    expand:
      - name: systemRequirements
        expand:
          - name: systemRequirement
            title: System Req.
            expand:
              - name: designRequirements
                expand:
                  - name: designRequirement
                    title: Design Req.


This creates:

- UserNeed

  - SystemRequirement

    - DesignRequirement


Multiple Expansions at Same Level


You can expand multiple relationships from the same entity:

sources:
  - query:
      from: UserNeed
    expand:
      - name: systemRequirements
        expand:
          - name: systemRequirement
      - name: validationTestCases
        expand:
          - name: validationTestCase
      - name: chapter



Entity Factory


Entity factories define default values for newly created entities. This is useful for:

  • Pre-filling fields based on context
  • Setting defaults for document placement
  • Ensuring consistency in new items


Basic Entity Factory

sources:
  - query:
      from: UserNeed
    entityFactory:
      status: "draft"
      priority: 3
      documentId: "Requirements/UserNeedSpecification"


When a user creates a new UserNeed, it will automatically have:

  • status set to "draft"
  • priority set to 3
  • documentId set to the specified document path "Requirements/UserNeedSpecification"


Entity Factory in Expansions


You can also define factories for nested entities:

sources:
  - query:
      from: UserNeed
    expand:
      - name: systemRequirements
        expand:
          - name: systemRequirement
            entityFactory:
              status: "draft"
              severity: "medium"

Constraints


Constraints provide advanced filtering capabilities, especially useful for document-based filtering and relationship constraints.


Apply Current Document Filter


The "applyCurrentDocumentTo" constraint filters entities to only those belonging to the current Polarion document:

sources:
  - query:
      from: UserNeed
    constraints:
      applyCurrentDocumentTo: UserNeed


This ensures:

  • Only UserNeeds from the current document are loaded
  • New UserNeeds are automatically created in the current document


You can also apply it to navigation paths:

constraints:
  applyCurrentDocumentTo: systemRequirements.systemRequirement



For any assistance, please don’t hesitate to reach out by submitting a ticket here.

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article