Skip to main content
See also: Constraints | Properties | Relationships | Binding Syntax

Two Expression Notations

Powersheet uses two distinct expression notations depending on the configuration layer:
diagram
If you are editing a data model YAML file (domainModelTypes, relationships), use $context. If you are editing a sheet configuration YAML file (sources, columns, formatters), use () =>.

Context Expression ($context)

Context expressions use dot-notation to access properties from the runtime context. They are used exclusively in data model configuration — specifically within constraint definitions on entity types and relationships.

How It Works

A $context expression is a property path that Powersheet resolves by traversing the context object at runtime. No JavaScript logic is supported — only direct property access via dot-separated keys.

Where It Is Used

Available Context Paths

Dynamic constraints with $context are evaluated per-row. Different rows can produce different constraint values depending on their source entity’s properties. For example, a UserNeed in a “Braking” document produces different constraint values than one in a “Steering” document.

Context Expression Examples

Filter linked items to the same document component as the source item:
When viewing a SystemRequirement from the “Braking” component, only DesignRequirement entities from “Braking” documents are loaded. Filter linked items to the same document as the source item:
This restricts loaded entities to the exact same LiveDoc document as the source entity, matching on both module name and folder. Filter picker options by source document type:
When a user opens a picker dialog, only entities from documents matching the source entity’s document type appear as options.

Complete Data Model Example with Context Expressions

In this model, SystemRequirement back-navigation to DesignRequirement entities filters by both module name and folder at load time, and additionally restricts picker results by document type.

Dynamic Value (() => expression)

Dynamic values use JavaScript arrow function syntax and are used in sheet configuration YAML files. They provide full JavaScript expressiveness for computing values, filtering data, and rendering content at runtime.

How It Works

A () => expression is a JavaScript arrow function that receives a context object. Powersheet evaluates the function at runtime and uses the returned value. The expression must be wrapped in quotes within the YAML to preserve the arrow function syntax.

Where It Is Used

formula affects persisted data — the calculated value is saved back to the data source. Use render if you only need to change how a value is displayed without modifying the underlying data.
Formatter expressions use a simplified syntax — they do not start with () =>. The expression is evaluated as a boolean condition directly (e.g., "context.item.Probability <= 99").

Context Availability by Location

Not all context properties are available in every location. The following table shows which context sub-objects are accessible in each usage location:

Dynamic Value Examples

Where clause — filter by current document:
The sheet loads only Requirement entities whose document.moduleName matches the current document’s module name, scoping results to the active LiveDoc. Where clause — filter by today’s date:
The resulting value must be in the correct format for the data type. For date fields, use .toISOString() to produce the ISO 8601 string that Polarion expects.
Where clause — combine multiple parameters:
Template literal syntax allows concatenating multiple URL parameters into a single filter value. Entity factory — set initial value from the source entity type:
When a user creates a new DesignRequirement entity in this sheet, the sourceType field is automatically populated with the Polarion work item type of the parent/source entity. Formula — calculate a value from other item properties:
The totalPrice column value is computed by multiplying quantity by unitPrice. This calculated value is persisted to the data source. Renderer — custom HTML output:
Renders each linked item name in bold, separated by commas. Display — show a property of a linked entity:
Instead of showing the raw document reference, the column displays the document’s human-readable title. Formatter — conditional styling:
Applies warningStyle to cells where the Probability value is 99 or below. Note the simplified syntax without () =>.

The Context Object

The context object provides runtime information to dynamic expressions. Its structure is hierarchical, with properties progressively available depending on the evaluation scope.

Context Object Structure

Context Tree Diagram

  • item, source, entity, and value are only available in per-cell contexts (formula, render, formatter, display)
  • document is available in where clauses and formatter expressions
  • In $context expressions (data model constraints), only source and its sub-properties are available

Notation Comparison

The two expression systems serve complementary purposes. Understanding when to use each prevents configuration errors.

Quick Reference


Complete Sheet Configuration Example

The following example demonstrates multiple dynamic value expression types in a single sheet configuration:
This configuration:
  1. Filters the Requirement source by the current document’s module name and future due dates
  2. Pre-fills the sourceType field on new entities from the parent/source entity’s work item type
  3. Calculates totalPrice from quantity and unitPrice (persisted)
  4. Displays the document title instead of a raw reference
  5. Renders linked items with bold formatting
  6. Highlights rows where Probability is 99 or below

See Also

  • Constraints — full reference on constraint configuration including stages, operators, and composition
  • Columns — column configuration properties including formula, render, and display
  • Formatters — conditional formatting and style definitions
  • Sources — source query configuration including where and entityFactory
  • Binding Syntax — dot-notation paths for column keys
  • Navigation Directions — direct and back relationship directions
  • Cardinality — how relationship cardinality affects expand patterns and column binding
Last modified on July 10, 2026