Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Query jira issues for component(s) using r programming

Michael Orozco
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
February 15, 2022

We are getting data from Jira. I don't have direct access to the database so I am using r programming to query jql data and trying to gather that information. I the Jira ticket that we have I see the component field is compromised by multiple values seperated by coma's. However that doesn't mean that field has exactly the same number of components.

However, I could have multiple components in one, but only one in another.

Components: comp1, comp2, comp3, comp4

Components: comp1, comp2

Components: comp2, 

etc..

The issue that we have is that when we query the component field and put it in a stage table. We only get one component back.

I have multiple question. Is the componet field one field that has multiple values that are comma seperated?  Or, are there multiple component fields to query the rest of the data?

In either case how would you query for that data?

 

 

 

 

1 answer

0 votes
Nic Brough -Adaptavist-
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 15, 2022

Welcome to the Atlassian Community!

The component field contains an array or list of option-like objects (components are options, same as single and multi-select list options are, but they have more functionality and data around them)

What you get when you read the field depends on how you're reading it.  Most read functions will spit out something like [1,2,3] when you try to print a simple text version of a list.

So, I'm a little unclear on a few things in your question

1) I could read it as if you had more than one components field, is that what you've done?

2) What, exactly, are you doing when you "query the component field"?  Running a search and seeing the components in the list of columns?  Using the REST API to fetch it in an external program?  Running some code inside Jira with a scripting app?

Michael Orozco
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
February 16, 2022

Nic,

Thank you for responding to my question. Let me try and answer you questions.

1. I am using r scripting language.  I am still learning it. I am a java developer, but was asked to learn this and use it. I am also using someone else's code and trying to learn from them as I am going through this. 

 

2. Here is some of the code that was left behind. Of course before all of this stuff is the libraries, db connection, etc.. It is put into a staging table on our server and we can query from there.

 

fields <- jira.metadata()
fields

 

tryCatch({
issues1 <- jira.query(table = "issues", fields = "id AS IssueId, Created, name
,'% Complete',' Start Date' as StartDate
, 'Target Date','Target end','Task','Target start'
, Updated,'Parent Link', 'Due Date','Product Line', 'Product Name','External ID',Progress, Project, Industry, Labels, Reporter
, Status, Priority
,'Affects Version/s' as AffectVersion, 'Planned version', 'Product Manager', 'Owner', 'Product(s)' as Products
, Assignee,'Time Spent','Time Tracking','Total Downtime'
,'Feature Availability','Epic Link','Epic Name', 'Epic Status'
, ERP,'Feature Type', Fix, 'Fix Description','Fix Urgency'
, 'Fix Version/s' as FixVersion, 'Flagged' ,'GA Date'
,'Start Date',Category,Cloudsuite,'Component/s' as Component,SubComponents
,'Release Focus','Customer Commitment', 'Customer Commit Date', 'Customer ID', 'Customer Name'
, Source, 'SDIS Defect ID', 'Root Cause Analysis', 'S Progress', 'S Remaining Estimate','Environment'
, 'Risk Level', 'Risk consequence','Reviewer', 'Change Risk','Change Status', 'Change Type','Code Complete','Code Complete Date'

,'Version Complete'
, 'Defect Cause','Defect ID','Deliverables', Impact, 'Impact CloudSuite'
, 'Incident ID', 'Incident Status', 'Incident Type'
, 'Issue Type', 'issueFunction'
, 'ISO Approval Ticket', 'ISO Approved', 'ISO Compliance Review'

, 'Linked Issues', 'Link to use case','Mandatory'
, Summary, description
,'Release Date', 'Released in version', 'Remaining Estimate', ' Report Date', 'Reported By'
, Resolution,'Resolution Description','Resolution Notes', Resolved
, 'Severity',Theme, Region, 'Reason for Fail'
",


where= paste0("project='",projectsymbol[1][1],"' AND Created >='",Created[1][1],"'"))


FinalInfor_Issues1 = get_jira_issues(jql_query = paste0("project='",projectsymbol[1][1],"' AND Created >='",Created[1][1],"'"))%>%
#head(1000) %>%
data.frame()

 

I believe the problem is here in the code. Because when I get the data from the database and put it in the staging table. When I query it, there is only the first field in column and nothing else.

However, I still don't know if there is only one column with all the data in it, or if there are multiple columns with the data in it.

Example.

Column1

comp1, comp2, comp3, etc.

or

Column1     Column 2     Column3     Column4

comp1         comp2         comp3        comp4           etc.

 

How can I find that out if I do not access to the database directly?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events