All eazyBI for Jira eazyBI for Confluence Private eazyBI

New calculated fields
eazyBI for Jira

Overview

The "Add new calculated field" option allows you to define new JavaScript calculated custom fields in the Jira import options. However, unlike defining new JavaScript calculated custom fields in eazyBI advanced settings, these custom fields are available for import into the particular Jira issues cube only.

This option is available for Jira system administrators, Jira trusted users, eazyBI admins, and eazyBI account users with roles allowing source data import. The settings are applied only within the specific Jira source application import.

New calculated fields are available in eazyBI for Jira Cloud and starting from version 6.6.0 on the server.

New calculated field

eazyBI can include new JavaScript calculated custom fields into the Jira source data import with the new calculated field option. You can [2] Add new calculated field from the eazyBI import options [1] "Custom fields" tab.

If you base your calculation on existing custom fields, you must first import these custom fields (at least as property) into the data cube.

First, specify the [1] Internal name for a new calculated field - a unique descriptive name of your new calculated custom field. Best practices for naming the custom fields: keep it short and use just lowercase without underscores, special symbols, or camelCase.

The [2] Display name for this calculated custom field will appear in the Jira import custom fields selection. That will be the name of the imported custom field in eazyBI. The [3] Data type defines what type of data the calculated field will return. Depending on the chosen data type, other frequently used options for the custom field will be available.

In [4] you can Add additional advanced settings that you require for the calculated field. These settings are similar to the ones described in the custom field import options.

Finally, the [5] Custom JavaScript code will calculate and return the results with the JavaScript return  statement. The return statement is a major difference compared to how JavaScript calculated custom fields assign value to fields defined in the eazyBI advanced settings. The dialog is similar to the one described in the custom field import options.

Use the JavaScript return  statement to retrieve the value changed with custom JavaScript code.

Once you have defined the new calculated field and its options, click [6] OK and see how to apply them.

Components

eazyBI imports issue Component as a Project dimension level by default. In the picture above, you can see the new calculated field options to import Component as a separate dimension with the following custom JavaScript code:

return issue.fields.components;

See how the approach differs when defining the JavaScript calculated field in the eazyBI advanced settings - Components.

Age since updated interval

Custom interval dimensions can be imported in eazyBI with the advanced settings. See examples here - Custom calculated field as an interval dimension. You can achieve that also with a new calculated field. Set the data type to "integer" and select the "Dimension" checkbox. Add the additional advanced settings:

time_unit = "seconds"
time_interval = "age"
intervals = "/10"
interval_unit = "days"

Add the custom JavaScript code for an age since updated interval:

if (!issue.fields.resolutiondate) {
  return Math.floor(Date.parse(issue.fields.updated) / 1000);
}

And click "Save". The specified parameters will define a new JavaScript calculated custom field that will return the interval age in days from the issue's last updated date till now for unresolved issues.

Creator

Works only for Jira Cloud app and starting from version 7.1 on the server.

You can use the configuration below to create a new dimension to display the issue creator (not the reporter). Set the data type to "string" and select the "Dimension" checkbox. Add the additional advanced settings:

json_fields = "creator"

Add the custom JavaScript code to get the issue creator:

return issue.fields.creator;

Click "Save". The specified parameters will define a new JavaScript calculated custom field that will return the creator of the issue.