Skip to main content

Prerequisites

Understand the Two Expression Notations

Powersheet supports two distinct expression syntaxes, each used in a different configuration context:
If you are editing a data model YAML file (entity types, relationships), use $context. If you are editing a sheet configuration YAML file (sources, columns, formatters), use () =>.
diagram
1

Add a Dynamic Where Clause to a Source Query

Dynamic where clauses let you filter source data using runtime values such as the current document or the current date.Filter by the current document:
When the sheet loads inside a LiveDoc, only records whose Module equals the current moduleName are returned.Filter by today’s date (show only future items):
Dynamic date values must return ISO 8601 format. Always call .toISOString() on Date objects. Returning a raw Date object will cause the query to fail silently.
Combine multiple document properties using template literals:
2

Set Dynamic Default Values with Entity Factory

Use entityFactory to pre-populate fields on newly created items with values resolved at runtime:
In this example, type is derived from the source entity’s type at runtime (for instance, a SystemRequirement source yields SystemRequirement_VerificationTestCase), while Status receives the static value Planned.
3

Add a Calculated Column with Formula

The formula property computes a value from other properties on the current entity. The computed value is persisted back to the data source on save.
The expression accesses entity properties through context.item. In this case it multiplies quantity by unitPrice each time the sheet refreshes.
formula modifies the underlying data — the calculated value is saved. If you only need to change how a value is displayed without modifying stored data, use render instead.
4

Add a Custom Renderer

Renderers produce custom HTML output for cell display. They do not affect persisted data.Inline render expression on a column:
Named renderer definition (reusable across columns):
Named renderers are defined in the top-level renderers section and referenced by name in the column render property.
5

Configure Conditional Formatting

Formatters apply styles to cells based on a boolean expression. Unlike formula and render, formatter expressions use simplified syntax — they do not start with () =>.
Apply the formatter to a column:
The formatter context provides access to context.document, context.item, and context.value.
6

Use Context Expressions in Data Model Constraints

In data model YAML files, use the $context notation to create dynamic constraints that filter relationship data based on the source entity’s properties.Filter linked items to the same document component:
When viewing a SystemRequirement from the “Braking” component, only DesignRequirement items from “Braking” documents are loaded.Filter by document name and folder:
Constrain picker to same document type:
$context constraints are evaluated per row. Different rows can produce different constraint values depending on their source entity’s properties. This enables context-sensitive filtering without separate configurations.

Context Object Reference

The context object provides different properties depending on where the expression is evaluated: Key context properties:
  • context.user — Current logged-in user (id, name)
  • context.document — Current document information (title, type, id, moduleName, moduleFolder, component)
  • context.item — Current entity with all its properties, e.g., context.item.StoryPoints
  • context.source — Parent/source entity in relationship contexts, including its type
  • context.value — Current cell’s display value

Verification

After saving your configuration changes:
  1. Reload the sheet in Polarion
  2. For where clauses: verify that only matching records appear (try opening the sheet inside different documents)
  3. For formulas: confirm the calculated column shows correct values and updates when source fields change
  4. For renderers: inspect cells for the expected HTML rendering
  5. For formatters: verify that styling applies when the condition is met and disappears when it is not
  6. For $context constraints: expand a relationship and confirm that only items matching the source entity’s document properties are loaded
You should now see dynamic values resolving correctly at runtime across all configured expression locations.

See Also

Last modified on July 10, 2026