Overview
Calculated columns use JavaScript formulas to derive values dynamically. Common examples include:- RPN (Risk Priority Number): Severity × Occurrence × Detection
- Risk scores: Probability × Impact
- Aggregated values: Sum, average, or collect data from linked items
- Conditional values: IF-style logic based on other field values
Method 1: Inline Formula Configuration
This method embeds the formula directly inrisksheet.json. Best for simple calculations.
Step 1: Define the Formula
Add your formula to theformulas section:
Step 2: Reference the Formula in Column Configuration
Add a column that uses this formula:Method 2: Top Panel Formula Configuration
Recommended for complex formulas or multiple lengthy calculations. This keepsrisksheet.json clean and makes formulas easier to maintain.
Step 1: Define Formula Stub
Inrisksheet.json, reference a function defined elsewhere:
Step 2: Add Column Configuration
Configure the column exactly as in Method 1:Step 3: Implement Formula in Top Panel
Open Menu → Customize Top Panel and add your JavaScript function:Formula API Reference
Theinfo parameter provides access to:
| Property | Description |
|---|---|
info.item | Data object containing all column values for the current row |
info.item['columnId'] | Access specific column value using its id |
info.cell | HTML DOM element of the current cell (rarely used in formulas) |
info.value | Current value of the cell (for cell decorators) |
Accessing Column Values
Use the columnid to reference values:
Advanced Formula Examples
Conditional Risk Calculation
Collecting Unique Values from Child Items
For aggregating data across hierarchy levels:The
risksheet.ds.getMasterRowsByColumnValue() API is available in version 24.9.1+. Use it to query related work items and aggregate their data.Persisting Calculated Values to Polarion
By default, calculated values exist only in the RISKSHEET UI. To save them to Polarion work items:Step 1: Create Custom Field
- Go to Administration → Custom Fields → Work Items
- Select the relevant work item type (e.g., Risk)
- Add a new field:
- ID:
rpn(must match columnbindings) - Name: Risk Priority Number
- Type: Integer (or appropriate type)
- ID:
- Mark the field as read-only in Polarion to prevent direct editing
Step 2: Enable Writing to Field
Add"readOnly": false to your column configuration:
Data Synchronization (Version 24.5.1+)
Starting with version 24.5.1, RISKSHEET includes improved data synchronization for formula columns:- Formula values persist correctly between Polarion and RISKSHEET
- Excel exports include calculated column values consistently
- Imported data without saved values will display correctly after running Check Stored Formulas
Verification
You should now see:- The calculated column displaying computed values automatically
- Values updating in real-time as you edit source columns
- Read-only cell styling (typically gray background) if formula column is not writable
- If persistence is enabled: values saved to Polarion work items and visible in work item forms
Troubleshooting
| Issue | Solution |
|---|---|
Formula returns NaN | Check that source columns contain numeric values, not strings or enums |
| Values not updating | Ensure source column IDs match exactly (case-sensitive) |
| Export missing values | Upgrade to version 24.5.1+ or use Check Stored Formulas |
| Hidden column not calculating | Make column visible during item creation, or use Check Stored Formulas afterward |
See Also
- Calculated Columns Reference - Complete API and formula syntax reference
- Formula Syntax - JavaScript formula syntax guide
- Formula Functions - Available formula functions
- Formula Examples - Real-world formula patterns
- Work with Formulas and Hidden Columns - Advanced formula scenarios
- Calculated Columns Missing in Exports - Troubleshoot export issues
Sources
Sources
KB Articles
- Configure calculated column (formula)
- Collect multiple link columns into one column
- Enable editing of read-only up-stream columns
AppConfig.tsAppConfigHelper.tsPolarionAppConfigManager.javarisksheet.jsonConfigureColumnsCommand.ts