Formatting templates
Within sumUp, calculation rules are used in nearly every context to tell the app which fields should be calculated and which output format should be used.
To further customize the output format, velocity templates can be used!
On this page you'll find some predefined templates that can be used right away to adapt a rule's output format.
Velocity template
To use a custom output format in the rule, select Velocity template as shown:

The velocity context
If you're unfamiliar with velocity templates, you might want to check out the official documentation.
The Velocity Context is initialized with the following content:
These keys can be used within the templates to customize the format.
key | Class | Description |
---|---|---|
$value | The computed value. | |
$number | A helper class to format numeric values. | |
$math SINCE VERSION 3.6.0 | A helper class for doing math calculations. | |
$jiraDateTimeUtils | internal | A helper class which has one function:
This function formats timespan according to the time configuration in JIRA. |
$formatter | JavaSimpleDate format with format ("EEE, d MMM yyyy h:mm a") |
Templates
Default format
#if($value)
$value
#end
Hours format
Assumes that the value is in seconds.
#set($H = '#')
#if($value)
#set($v = $value.doubleValue()/3600.0)
$number.format("$H.$H$H",$v)h
#end
Jira timespan format
Assumes that the value is in seconds.
#if($value)
$jiraDateTimeUtils.getTimeFormatedString($value.longValue())
#end
Days, hours and minutes format
Assumes that the value is in minutes.
#set($H = '#')
#set($intMin = 999999)
#set($intHour = 999999)
#set($Min = $value.doubleValue())
#set($Hour = 0)
#set($Day = 0)
#if($value)#foreach($numMin in [ 1..$intMin ] )
#if($Min < 60 )
#break
#else
#set($Min = $Min - 60)
#set($Hour = $Hour + 1)
#end
#end#foreach($numHour in [ 1..$intHour ] )
#if($Hour < 24 )
#break
#else
#set($Hour = $Hour - 24)
#set($Day = $Day + 1)
#end
#end
$number.format("$H.",$Day)$number.format("$H.",$Hour)$number.format("$H",$Min)
#end