Prerequisites
- A working domain model with at least one entity type
- A sheet configuration displaying entity properties
- Access to the project SVN repository to edit YAML configuration files
Choose Your Approach
Powersheet supports two mechanisms for computed properties, each suited to different use cases:| Approach | Syntax | Runs On | Best For |
|---|---|---|---|
| Server-rendered property | serverRender: "$item.id" | Server (Velocity) | Accessing Polarion services, secure calculations, cross-entity queries |
| Dynamic value expression | formula: "() => context.item.qty * context.item.price" | Client (JavaScript) | UI-driven calculations, formatting, parameter-based filtering |
Option A: Server-Rendered Property (Velocity)
Use this approach when you need to compute a value on the server using Polarion platform services and work item data.Step 1: Add the Property to Your Domain Model
Open your domain model YAML file and add a property with aserverRender pattern to the target entity type. The value is a Velocity template expression that the server evaluates for each work item:
serverRender value is a standard Velocity template string. The server evaluates it in a context that includes the current work item and Polarion platform services.
Step 2: Use Context Variables in Your Template
Server-rendered properties have access to these context variables during evaluation:| Variable | Type | Description | Availability |
|---|---|---|---|
$item | ModelObject | Work item model object (.id, .title, .status, .author, .created, .updated) | All work items |
$wi | IWorkItem | Low-level Polarion work item API for operations not available on $item | Work item entities only |
$module | IModule | Current LiveDoc (.moduleFolder, .moduleName, .space) | Document-scoped entities |
$context | IDatabridgeContext | Powersheet context (project, document scope, query helpers) | Always |
$tx | Transaction | Current transaction for read-only operations | Always |
| Service Variable | Purpose |
|---|---|
$trackerService | Query work items, access project metadata, run Lucene queries |
$txService | Transaction management and execution context |
$repositoryService | Access project metadata, users, roles, and repository configuration |
$securityService | Check user permissions, implement role-based visibility |
$trackerService:
Step 3: Mark the Property as Read-Only
Server-rendered properties are automatically treated as non-editable by the rendering mechanism. You should explicitly setreadable: true and updatable: false in your property definition to make the intent clear:
Step 4: Display the Property in Your Sheet
Add a column in your sheet configuration that binds to the computed property:Step 5: Use Custom Field Data in Templates
If your entity type maps to a Polarion custom field viacustomFieldName, you can reference that property within the Velocity template:
Step 6: Alias Field Names with serverName
When the Polarion field name differs from the client-facing property name, useserverName to create an alias:
Option B: Dynamic Value Expression (JavaScript)
Use this approach for client-side calculations in your sheet configuration. Dynamic value expressions use JavaScript arrow function syntax and are evaluated in the browser.Step 1: Add a Formula Column
To compute a value from other properties on the current item, use theformula property in your column definition:
Formula writes back to the data source
Formula writes back to the data source
The
formula property calculates a value and saves it back to the underlying field. If you only need to change how a value is displayed without modifying data, use render instead.Step 2: Understand Context Availability
Not all context properties are available in every location. The available properties depend on where the expression is used:| Usage Location | .user | .sources | .document | .item | .value | .source | .entity |
|---|---|---|---|---|---|---|---|
where | ✅ | ✅ | ✅ | — | — | — | — |
entityFactory | ✅ | ✅ | — | — | — | — | — |
formula | ✅ | ✅ | — | ✅ | ✅ | ✅ | ✅ |
render / renderers | — | — | — | ✅ | ✅ | — | — |
formatter | — | — | ✅ | ✅ | ✅ | — | — |
display | — | — | — | ✅ | ✅ | ✅ | — |
Step 3: Use Dynamic Expressions in Different Locations
Filter a query by URL parameter:Step 4: Add Conditional Formatting
Formatter expressions use a simplified syntax without the() => prefix. The expression is evaluated as a boolean condition directly:
Unlike other dynamic expressions, formatter
expression values do not use the () => prefix. They are evaluated as direct boolean conditions.Debugging Computed Properties
Server-Rendered Properties
If a server-rendered property returns#SERVER_RENDER_ERROR, the Velocity template failed to evaluate. Common causes:
| Error Type | Cause | Fix |
|---|---|---|
ParseErrorException | Invalid Velocity syntax | Check template for unclosed directives or typos |
MethodInvocationException | Called method threw an exception | Verify the method exists on the target object |
ResourceNotFoundException | Referenced resource not found | Check that $item, $module, or $wi is available for your entity type |
Dynamic Value Expressions
Client-side expressions fail silently if the context property is not available. Verify:- You are using the
() =>prefix (not$context, which is for model constraints only) - The context property is available at the location where you are using it (see the availability table above)
- Property names match your domain model exactly (case-sensitive)
Verification
After saving your YAML configuration and reloading the sheet:- Server-rendered property: You should now see the computed value in the column. Edit the underlying work item fields and reload — the computed value updates to reflect the changes
- Dynamic formula: You should now see the calculated value appear. If using
formula, verify the value is persisted by checking the work item in Polarion - Render/display: You should now see formatted output in the cell without any data modification
#SERVER_RENDER_ERROR in a column, refer to Debug Template Errors for troubleshooting steps.
See Also
- Use Velocity Templates — write and test Velocity template expressions for server rendering
- Access Polarion Services — use platform services like
$trackerServicein your templates - Debug Template Errors — diagnose and fix server rendering failures
- Configure Dynamic Expressions — full guide to
() =>expressions in sheet configuration - Add a Custom Property — add standard (non-computed) properties to entity types
- Configure a Formatter — apply conditional styling with formatter expressions
Sources
Sources
Source Code
ServerRenderer.javaProperty.javaDataPropertyFactory.javaMetadataTest.javaServerRendererTest.javaQueryDataTest.java
- Dynamic Value Expressions (Confluence)