Query Properties
EntityQuery does not support a
select clause for projecting specific properties. All properties defined for the entity type in the data model are returned automatically.
The from Clause
The from clause specifies the root entity type for the query. The value must exactly match an entity type name defined in the domainModelTypes section of the data model YAML. Entity type names use PascalCase.
from value against the metadata system to locate the entity type definition, including its mapped Polarion work item type, properties, and available navigation properties. If the entity type is not found in the metadata registry, the query fails with a validation error.
Common entity types (using the standard RTM example model):
For the complete list of entity type properties and Polarion type mappings, see Data Model Types and Polarion Type Mapping.
The where Clause
The where clause defines filter predicates that restrict the result set. If any predicate is not supported for its field, the whole query stops with an error and no rows are shown. A predicate is never silently skipped, so the sheet never shows rows the query meant to exclude.
See Predicates for the full predicate syntax and Query Execution for which predicates can run.
The expand Clause
The expand clause specifies which navigation properties to load inline with the query results. Navigation properties represent relationships between entity types defined in the data model. The expand syntax differs based on the relationship cardinality.
Many-to-One (N:1) Expansion
For many-to-one relationships, the expand loads a single related entity. Uses thedirect navigation property name from the relationship definition.
Chapter for each UserNeed. In the data model, the relationship defines direct.name: chapter on the many side.
One-to-Many (1:N) Expansion
For one-to-many relationships (the reverse of N:1), the expand loads a collection of child entities. Uses theback navigation property name.
UserNeed entities for each Chapter. In the sheet, these appear as expandable child rows creating a new hierarchy level.
Many-to-Many (M:N) Expansion
Many-to-many relationships require a two-level expand that traverses through an association entity to reach the target entity.systemRequirements) navigates to the association entities. The second level (systemRequirement) navigates from each association to the actual target SystemRequirement entity. This two-level pattern is required because the data model represents M:N links through an intermediate association.
For complete expand syntax including nested multi-level expansion, see Expand Clause.
The orderBy Clause
The orderBy clause defines the sort order for query results. Each item specifies a property path and an optional sort direction.
orderBy clause in the source configuration maps to the sortBy property in the sheet configuration, which uses a slightly different format:
Query Execution Flow
The server API processes an EntityQuery through the following stages:- Metadata resolution — The
fromclause is resolved against the metadata registry to identify the target entity type, its Polarion work item type mapping, and available properties. - Security enforcement — The server verifies the current user has read permission for the entity type. If the entity type is not readable, the query returns no rows.
- Predicate translation — The
whereclause predicates are translated into the query. A predicate that cannot be translated stops the query with an error. - Query execution — The
wherepredicates, including those on document properties, the entity type, the project scope and the data model constraints run together as one query against Polarion, sorted byorderBy. Properties specified in theexpandclause are loaded with it, following the relationship paths defined in the data model. - Row permissions — Work items the current user cannot read are dropped from the result.
- Paging —
takeandskipare applied to the readable result. - Result assembly — The final result set is returned with entity metadata.
Query Result Structure
Each entity returned by an EntityQuery includes standard metadata fields alongside the data model properties:
Additional fields depend on the properties defined for the entity type in the data model. Custom fields, enum properties, and computed (server-rendered) properties are included when defined.
Server-Rendered PropertiesProperties backed by Velocity templates are evaluated server-side during query execution. The Velocity context includes variables
item, tx, context, and pObject for template evaluation. See Velocity Templates and Context Variables.Primitive Field Type Mapping
When entity properties are returned in query results, Polarion custom field types are mapped to their runtime equivalents:Enum Property Resolution
When the metadata system discovers enum properties on an entity type, Powersheet automatically creates data sources for loading the available enum options. This powers dropdown pickers in the sheet without manual source configuration. The auto-generated enum source uses the following resolution pattern:- Source ID:
system.enums.<enumId>(e.g.,system.enums.severity) - Query construction: Filters by
polarionProto,polarionType,projectId, andenumIdfrom the entity metadata - Display mapping: Each enum option provides a display label and internal value for the picker
Complete YAML Example
A complete source configuration demonstrating all EntityQuery properties within a sheet configuration:- Root query with
from,where, andorderByonUserNeed - N:1 expansion via
chapter(direct navigation property) - M:N expansion via
systemRequirements.systemRequirement(two-level association traversal) - Deep nesting continuing through
designRequirements.designRequirementfor a full traceability chain - Column bindings using dot-notation matching the expansion path structure
- Picker configuration with
list.searchandlist.createNewon reference columns
Cardinality and Query Pattern Summary
Related Pages
- Predicates — filter syntax for
whereclauses - Expand Clause — detailed expand syntax and nesting rules
- Query Context — runtime parameter reference
- Document Filtering — document-scoped query patterns
- Baseline and Revision Queries — historical data queries
- Data Model Types — entity type definitions
- Relationships — relationship and navigation property configuration
- Sources — sheet source configuration referencing EntityQuery