Loading...
 
Skip to main content

History: Mathematical Calculation Tracker Field

Source of version: 13 (current)

Copy to clipboard
            ! {{page}}
A basic tracker field that calculates its value from the other fields in the tracker item. The calculation uses the same syntax as ((Calculations)). It is very useful for ((Grouped Data))

Available functions are limited to the basic ones not needing the object-type and object-id.

The other fields are available as variables based on their permanent name.

{CODE(caption=Sample)}
(mul priority severity)
{CODE}

!! Samples of formula you can use in tracker fields
!!! Dates
{CODE(caption="Calculate age from date of birth")}(if childrenBirthDate (round (div (sub (date) childrenBirthDate) 31536000 ) 1)){CODE}

The syntax is explained in more details: ((Advanced Rating))


!! Math fields can mirror output behavior from another field.
Useful for currency calculations, itemlink or other field calculations where the output must be similar to the output of those fields
New in ((Tiki22)) and backported for 21.2


!! Test Your Calculations with the fitness plugin
The sample above is rather simple, but calculations can quickly become more complex. Make sure it produces the results you expect by creating a test suite using ((PluginFitnesse)). It can also serve as a documentation.

{CODE(caption=Examples)}
{FITNESS()}

{TRACKERMATH(trackerId=42)}
priority|severity|importance?
1|1|1
2|3|6
10|10|100
{TRACKERMATH}

{FITNESS}
{CODE}

In some cases, some of the data depends of the search index being up to date. So this can be a good idea: ((Cron Job to Rebuild Search Index))


Related:
* ((Trackers))
* ((Tracker fields))
* ((Calculations))

-=alias=-
* (alias(Mathematical Calculation Field))