Show only Active components in issue properties

Hi,

I have created a simple table that shows the list of issues. I have added in Issue properties - [Measures].[Issue components], to show the components. However, I would like to only show the “Active” and not the “archived” components. Is there a way to removed the archived components from the issue properties?

thank you

Hi @Jim

Currently, eazyBI does not import Component Status in the data cube, so this information has to be imported additionally.

Go to the Source Data tab in eazyBI, click the “Add new source application” button and choose the REST API data source.

In the Source data URL use the Jira Get All Projects endpoint:

https:// your Jira URL here .com/rest/api/2/project

Set the Authentication parameters supported by your instance (for me “Username & password” is sufficient).

In the Content parameters section, click the “Add custom JavaScript code” button, and an empty text window will appear.
The following code will go through all of your Jira projects and retrieve all the component IDs together with their status- Active or Archived:

JavaScript code to get all components
var components = [];
getDocument("/rest/api/2/project/" + doc.key + "/components", {ignoreErrors: [404]}, function(result){
  if (result && result.values) { 
    for(let comp of result) {
      let status = comp.archived ? "Archived" : "Active";
        components.push({
          component_id: comp.id,
          comp_status: status
        })
    }
  } 
});
return components;

If you have a large number of projects and components in your Jira instance and you would like to limit this to just a few projects, you can introduce an “if” statement to only get the components for certain projects:

JavaScript code to get components from specific projects
var components = [];
if (doc.key == "D11" || doc.key == "D2") {
  getDocument("/rest/api/2/project/" + doc.key + "/components",{ ignoreErrors: [404] },
    function (result) {
      if (result && result.values) {
        for (let comp of result) {
          let status = comp.archived ? "Archived" : "Active";
          components.push({
            component_id: comp.id,
            comp_status: status,
          });
        }
      }
    });
}
return components;

Select the necessary import frequency and click “Continue”.
In the data mapping screen, set up the import the following way:

Start the import, and after the import finishes, head over to your Analyze tab and create a report
with individual issues in Rows and define a new calculated measure in the Measures dimensions with the following formula:

Generate(
  Filter(
    [Project].[Component].GetMembersByKeys(
      [Issue].CurrentHierarchyMember.get('Component IDs')
    ),
    CoalesceEmpty([Measures].[Project Comp Status],"") <> "Archived"
  ),
  [Project].CurrentHierarchyMember.Name,
  ", "
)

In my example, I’ve archived the “DOWN” component, and you can see that the new measure is showing all Active components without the Archived “DOWN” one:

Let me know if this works as expected or if you need additional assistance along the way!
​Best regards,
​Nauris / eazyBI support