Counting number of attachments on issues

Hi EazyBI Community,

I know that EazyBI does not import attachments, for obvious reasons. However, one of our users wishes to see a tabular view of all issues in a project and whether those issues have attachments associated with them or not.

I wondered if there was an easy (eazy) way of showing for a particular issue in the Issue dimension either:

a) whether it has any attachments on it (Yes/No) or
b) the number of attachments associated with the issue (1,2,3 etc)

I guess I could perhaps create a calculated field in JIRA which records the attachment count and then imports it as a custom fields in EazyBI, but I wondered if there was anything in EazyBI which would give you access to the number of attachments on an issue.

Best,

Gary

eazyBI does not support attachment import by default. However, you can import information about attachments (count) using some options eazyBI provides.

There are two different ways if you are on Cloud or Server.

eazyBI or Jira Cloud
You can use calculated JavaScript custom field for importing count of attachments or flag if an issue has or does not have attachments.

[jira.customfield_attachment]
name = "Attachments"
data_type = "integer"
json_fields = ["attachment"]
measure = true
javascript_code = '''
if(issue.fields.attachment && issue.fields.attachment.length >0) {
  issue.fields.customfield_attachment = issue.fields.attachment.length;
}
'''

With more advanced Javascript you can access some other data of attachments as well.

eazyBI for Server
You can’t access attachments via JavaScript code. You would like to use additional data import, for example, with SQL to import attachments.

Here is an example SQL for accessing attachments from Jira database:

select issueid, created, 1 as count from fileattachment

You can use a mapping to issue dimension for issueid column with ID column, and skip missing. You can map created date of attachment to Time dimension and import count as a measure.

This measure will work by default with Issue dimension, Time dimension, and some single level custom field dimensions. It will require some calculations for more complex reports.

Daina / support@eazybi.com

1 Like

Hi Daina,

Thanks for your help with this, it is much appreciated!

We have set up the import on Server as follows:

We have issues coming into the cube as you can see above and I can interrogate the attachments on each issue using the Issues dimension and the user defined measure that we made called Attachment (see screenshot below)

So far, so good.

I can also pull other information in from the Issues dimension by adding the relevant measures (see below):

However, one of the request types (this is a JIRA Service Desk Project) that we want attachment information from is a Customer Request Type called Post-trip report (see below where I’ve filtered using Customer Request Type):

These Post-trip forms are linked to the main travel form using an issue link in JIRA (we use the Blocks relationship for this):

49

The Post-trip forms contain their own unique information and simply link to the main travel form. As such, a Post-trip form will not have a category, it will be specified on the main travel issue to which it is linked.

We have defined a custom issue link in EazyBI as follows:

15

Which gives us a dimension we can use to query information through that issue link.

What I want to do, is query some of the information on the post-trip form and bring it into this table whilst retaining the attachment count for the post-trip form, and I just can’t do it:

As soon as I include the post-trip dimension, the attachment count disappears, so I go from this:

To this:

How can I display the attachment count for Post-trip reports, and on the same table show information that I’m pulling in from the post-trip reports like this:

This gives me what I need in the table, but no attachment count:

Grateful of your help as always :slight_smile:

Best wishes,

Gary