consult to the upgrade guide .
Search template
When creating a calculate Number custom field character, you can configure the Search template as
- Number range searcher– Allow searching for a number that is in a given range
- Number range seeker ( Statistics-compatible ) –
Allow searching for a number that is in a given range. Supports Statistics Gadgets.
Using these searchers you will be able to search issues within a numeral range. The default search template is Number range searcher ( Statistics-compatible ). If you select “ none ” for the searcher, then you won ’ t see any reference point to this field in the Issue Navigator search fields. note that changing a custom field searcher requires a re-index. Number range searcher (Statistics-compatible) is a customs statistics compatible searcher provided by JMCF that allows Number character custom-made fields of Jira and JMCF to be used in the statistics gadgets. See here for more information .
Configuring the Groovy formula for a Calculated Number custom field
Starting from 2.0.0 BeanShell has been replaced by Groovy in the JMCF addition. Scripts written in BeanShell will work unaltered in Groovy except for some particular cases. To write a formula for the Calculated Number custom field type ;
- Locate the custom field on the Custom Fields government page .
- Click on the cog wheel and click on
Configure
- Click on
Edit Groovy Formula
- In the editor write a Groovy script that returns a number. Also, you can test your script against any issue using the Groovy script tester.
- Click on
Save.
As documented on the Expected Value tab key of the Groovy editor avail, the Groovy rule must return a number ( Integer, Long or Double ) or null
. Examples of Groovy formula for a calculate Number custom battlefield :
- childlike Math calculation such as ,
2+3
- A Groovy formula to reference any field of the issue that returns an Integer or float such as ,
issue.get("Story Points")
- A Groovy construction that includes arithmetical operators equally well as any other Groovy operator, and Groovy method acting calls
issue.get("Story Points") * 5
issue.get("Affects Version/s").size()
- A Groovy expression that adds two custom fields, such as “ Business Value ” and “ technical Value ” to get an “ overall Value ” :
issue.get("customfield_10114") ?: 0 + issue.get("customfield_10150") ?: 0
- A String representing a act returned either by a changeless or a Groovy saying. The String is converted to a Double .
issue.getKey().substring(5)
By nonpayment, the Calculated Number custom-made battlefield character value is displayed using Jira ‘s default act format ( if you leave the Number Format Expression
blank ). however, you can customize it using Groovy. To configure a format for a count Number custom field type ;
- Locate the custom field on the Custom Fields administration page .
- Click on the cog wheel and click on
Configure
- Click on
Edit Format Expression.
- In the editor write a Groovy script to format the number returned by the Groovy formula (see above).
- You can test you written script against any issue using the Groovy script tester.
- Click on
Save.
The Groovy handwriting must return a String containing HTML markup. Example 1 Consider an case where you want to calculate the come to be paid in dollars for the Time Spent on the publish. For this, you will need to first calculate the measure to be paid and then format it using the numberTool to display it as a currency. Groovy formula:
(issue.get("timespent")/60/60) * 20
Groovy format:
numberTool.format('currency',value)
If the Time Spent on the issue is 7200
seconds, the Groovy expression will return the number 40
and it will be formatted to $40.
Example 2
Consider another exercise where you want to display an picture to the left of the field value depending on the field value. For this, you will need to format the respect returned by the Groovy rule using the numberTool and add an IMG chase to display an icon to the leave of the phone number. Groovy format:
if (value > 21) return ""+numberTool.format(value); else if (value >= 10) return "
"+numberTool.format(value); else return "
"+numberTool.format(value);
If the Groovy formula returns 23, the deliberate battlefield is displayed as
Customizing the display of the Calculated Number custom discipline type value on the issue detail view
You can define a speed template that will return the Html representation of the forecast custom-made airfield on the issue contingent scene. Leave it empty to use the default option template. To write a speed template for a calculate Number custom-made playing field type rate ;
- Locate the custom field on the Custom Fields administration page .
- Click on the cog wheel and click on
Configure
- Click on
Edit Velocity Template
. - Input the template.
- Click on
Save.
You can use the follow Velocity variables in the template :
$value
: the raw field value, a number in Integer or Float format.$formattedValue
: the field value formatted according to the field configuration above- and other variables described onthis page
For case :
$formattedValue
displays the format rate of the airfield with a dash border .
Customizing the display of the Calculated Number custom sphere type value on the search list opinion
You can define a speed template that will return the Html representation of the forecast custom discipline on the search list view. Leave it empty to use the default template. To write a speed template for a calculate Number custom field type value ;
- Locate the custom field on the Custom Fields administration page .
- Click on the cog wheel and click on
Configure
- Click on
Edit List View Velocity Template
. - Input the template.
- Click on
Save.
You can use the follow Velocity variables in the template :
$value
: the raw field value, a number in Integer or Float format.$formattedValue
: the field value formatted according to the field configuration above- and other variables described onthis page
For exemplar :
$formattedValue
displays the format respect of the sphere with a daunt bound .
Displaying the Calculated Number custom field type value on Transition and Edit screen
The Never show on Transition and Edit screens
option controls whether the calculate Duration custom-made field can appear on conversion and edit screens. If you select this option, the field will not be visible on any Edit or Transition screen, even if it is added to the filmdom .
Accessing the Calculated Number customs field respect from other Groovy scripts
You can access this field using any of the comply getters of the Issue interface
-
get("Your custom field name") or get("customfield_xxxxx")
that returns a number in a duplicate format . getAsString("Your custom field name")
or
getAsString("customfield_xxxxx")
String
that returns a representing a act .