Zum Hauptinhalt springen
Version: Version 22

Common calculations


Introduction​

This article contains ready-to-use calculation examples for the most common patterns in Fortes Change Cloud. Each example is self-contained and can be adapted to your own field names and object types.

For the full calculation syntax reference and block documentation, see Calculations.


Status indicator based on count​

Show a green or red image on a portfolio item depending on whether related log items exist. This pattern is typically used for "lessons learned filled in" or "plan items registered" dashboards.

The status field uses type Image with values Green;green,Red;red.

<calculations>
<!-- Green when at least one lesson-learned item exists under the ProjectReport -->
<calculation foldertypes="5003" break="true">
<depends>
<field>CustomY</field>
</depends>
<condition>
<cmp condition="greater">
<count>
<folderFilter foldertype="6051" relation="ProjectReport" />
</count>
<value>0</value>
</cmp>
</condition>
<value>green</value>
</calculation>
<!-- Red as fallback -->
<calculation foldertypes="5003">
<depends>
<field>CustomY</field>
</depends>
<value>red</value>
</calculation>
</calculations>

CustomY is a trigger field on the Lesson learned level with calculation option reference=ProjectReport. Change foldertype="6051" to 5602 for plan items.


Sum child values to a higher level​

Aggregate a numeric field from plan items (feature level) up to a portfolio item (epic level).

Plan item: Custom14 (the value to aggregate):

Calculation option: reference=ProjectReport

Portfolio item (the aggregated result):

<calculation foldertypes="5003">
<sum>
<folderFilter foldertype="5602" relation="ProjectReport" />
<field>Custom14</field>
</sum>
</calculation>

The same pattern applies for summing project-level fields up to a folder or programme.


Sum plan items at project level​

Aggregate a field from all assigned plan items up to the project level. The IsAssigned filter excludes template rows.

<calculation foldertypes="5000">
<sum>
<folderFilter foldertype="5602" parentsearchstructure="FirstChild=5601">
<IsAssigned filterValues="true" />
</folderFilter>
<field>CustomX</field>
</sum>
</calculation>

Calculation option: 0


Calculating a percentage​

Divide one field by another and multiply by 100.

<calculation>
<mul>
<div>
<field>CustomX</field>
<field>CustomY</field>
</div>
<value>100</value>
</mul>
</calculation>

Result: (CustomX / CustomY) × 100


Absolute difference between two fields​

Calculate the always-positive difference between two fields, regardless of which is larger.

<calculation>
<abs>
<add>
<field minus="true">Custom153</field>
<field>Custom154</field>
</add>
</abs>
</calculation>

Example: Custom153 = 100, Custom154 = 150 → result is 50. If the values are reversed, result is still 50.


Count open actions on a project​

A two-field pattern to count log items with a specific status value at project level.

Action log: CustomA (copies status, used as trigger):

<calculation>
<depends>
<field>Status</field>
<field>OrderNr</field>
</depends>
<folderfield>
<field>Status</field>
</folderfield>
</calculation>

Calculation option: 1,reference=P2Project

Project: CustomB (counts open actions):

<calculation foldertypes="!4901">
<depends>
<field>CustomA</field>
</depends>
<count>
<folderFilter foldertype="6041" parentsearchstructure="FirstChild=6040">
<P2Project operator="equals" filterValues="%pageid%" />
<Status operator="equals" filterValues="Open" />
</folderFilter>
</count>
</calculation>

Copy a field value via object reference​

Take over the value of a field from a referenced object.

Custom1: object reference field pointing to a project.

Custom2: field that copies the value from the referenced object:

<calculation>
<folderfield>
<field reference="Custom1">Custom105</field>
</folderfield>
</calculation>

Calculation option: 1


Cross-object trigger using depends​

When a calculation depends on a field from a different object level, use <depends> together with a calculation option to wire up the trigger.

Plan item: CustomA (copies end date, acts as trigger):

<calculation>
<folderfield>
<field>Enddate</field>
</folderfield>
</calculation>

Calculation option: relation=ProductID[6061]

Log item: CustomB (reads from the plan item via the trigger):

<calculation>
<depends>
<field>ProductID</field>
</depends>
<folderfield>
<field reference="ProductID">CustomA</field>
</folderfield>
</calculation>

Record the date when a specific field changes​

Store the modification date whenever a particular field changes. Useful for audit trails.

<calculation>
<depends>
<field>Custom121</field>
</depends>
<folderfield>
<field>ModificationDate</field>
</folderfield>
</calculation>

Risk score​

Multiply risk severity by risk likelihood to produce a numeric score. Used directly on a risk object.

<calculation>
<mul>
<field>RiskSeverity</field>
<field>RiskLikelihood</field>
</mul>
</calculation>

This field is commonly used as input for a conditional status field (e.g. green if score < 9, red if score ≥ 9).


Conditional value based on a referenced field​

Return a value depending on the content of a field on a referenced object.

<calculations>
<calculation foldertypes="5000" break="true">
<condition>
<cmp condition="after">
<field reference="Portfolio">Custom2</field>
<field>Enddate</field>
</cmp>
</condition>
<value>Yes</value>
</calculation>
<calculation foldertypes="5000">
<condition>
<cmp condition="before">
<field reference="Portfolio">Custom2</field>
<field>Enddate</field>
</cmp>
</condition>
<value>No</value>
</calculation>
</calculations>

Calculation option on the project field: 1

Portfolio field Custom2 requires calculation option: relation=Portfolio[5000]


Build an HTML hyperlink using <concat> to display a clickable link in a grid or canvas. Replace the URL with your own environment URL.

<calculation>
<concat separator="">
<value>&lt;a href="https://YOUR-ENVIRONMENT.fortes-online.com/online/Folder/Folder.jsp?FolderID=</value>
<field>FolderID</field>
<value>" target="_blank"&gt;&lt;b&gt;</value>
<field>Name</field>
<value>&lt;/b&gt;&lt;/a&gt;</value>
</concat>
</calculation>

Result: a bold clickable link showing the item's name, opening in a new tab.


Dependency log​

Show a log on a project that tracks dependencies between plan items, including buffer days and a status indicator that turns red when the successor starts before its predecessor ends.

This pattern requires a custom log object and trigger fields on the plan item level. The internal names used below are examples; choose names that fit your configuration. The C- prefix is added automatically by FCC.

Step 1: Trigger fields on Plan item level​

Add two custom fields on the Plan item object. These fields act as calculation triggers so changes to plan item dates propagate into the dependency log.

Internal nameDisplay nameTypeCalculation option
CustomXEnd date triggerDaterelation=CAfhankelijkheid_plan_item[1000003]
CustomYStart date triggerDaterelation=CAfhankelijk_plan_item[1000003]

Replace 1000003 with the actual ID of your custom log object.

CustomX calculation:

<calculation foldertypes="5602">
<folderfield>
<field>Enddate</field>
</folderfield>
</calculation>

CustomY calculation:

<calculation foldertypes="5602">
<folderfield>
<field>Startdate</field>
</folderfield>
</calculation>

Step 2: Fields on the custom log object​

Add the following fields to the custom log object.


C-Afhankelijkheid_plan_item: Object reference to the predecessor plan item

Type: Object reference (Plan item), Usage: Conditional

<conditions>
<dependencyconfig>
<options>
<dependingfield>C-Afhankelijkheid_project</dependingfield>
<foldertype>5602</foldertype>
<filterfield>P2Project</filterfield>
</options>
</dependencyconfig>
</conditions>

C-Afhankelijk_plan_item: Object reference to the successor plan item

Type: Object reference (Plan item), Usage: Conditional

<conditions>
<dependencyconfig>
<options>
<dependingfield>P2Project</dependingfield>
<foldertype>5602</foldertype>
<filterfield>P2Project</filterfield>
</options>
</dependencyconfig>
</conditions>

C-Afhankelijkheid_project: Object reference to the project

Type: Object reference (Project). No calculation needed.


C-Afhankelijkheid_einddatum: End date of the predecessor plan item

Type: Date, Usage: Computed

<calculation>
<depends>
<field>CustomX</field>
</depends>
<folderfield>
<field reference="C-Afhankelijkheid_plan_item">Enddate</field>
</folderfield>
</calculation>

C-Plan_item_startdatum: Start date of the successor plan item

Type: Date, Usage: Computed

<calculation>
<depends>
<field>CustomY</field>
</depends>
<folderfield>
<field reference="C-Afhankelijk_plan_item">Startdate</field>
</folderfield>
</calculation>

C-Bufferdagen: Calendar days between predecessor end and successor start

Type: Number, Usage: Computed

A positive value means there is slack. A negative value means the successor starts before the predecessor finishes.

<calculation>
<depends>
<field>C-Afhankelijkheid_einddatum</field>
<field>C-Plan_item_startdatum</field>
</depends>
<nrdaysbetween>
<field reference="C-Afhankelijkheid_plan_item">Enddate</field>
<field reference="C-Afhankelijk_plan_item">Startdate</field>
</nrdaysbetween>
</calculation>

C-Afhankelijkheid_status: Status indicator

Type: Image (Green;green,Red;red), Usage: Computed

<calculations>
<!-- Green when buffer >= 0: successor starts after predecessor ends -->
<calculation break="true">
<depends>
<field>C-Bufferdagen</field>
</depends>
<condition>
<cmp condition="smaller" value="0">
<field>C-Bufferdagen</field>
</cmp>
</condition>
<value>green</value>
</calculation>
<!-- Red when buffer is negative: overlap detected -->
<calculation>
<depends>
<field>C-Bufferdagen</field>
</depends>
<value>red</value>
</calculation>
</calculations>

Step 3: Add the log to the project model​

In the project model, add a new segment of type List on the overview page or a custom layout. Select the custom log object and configure the desired columns. The Name column is mandatory and cannot be removed.