Forums

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

Jira, Postgres, R scripting query if else statement?

Michael A Orozco April 25, 2022

I am querying Jira with an R Script. I get the data, and put that data into temporary Postgres tables.

I then use postgres sql to modify the data and then put it into a more permanent table, or tables. 

However here is my problem. I can't run a if else, or case then statement, modify and return data with my statement? I can run a query that works, but I have over 3500 rows of data. When I run it with this query it only returns 1700+ rows, and skips the null rows. I want to return all rows even if it is null. 

Here Is the query:

,(regexp_matches(split_part("Linked Issues"::TEXT,',', 1), '[0-9]+\.?[0-9]*'))[1]::numeric AS LinkedIssueID

I tried to put a case statement around it, but it would not let me make a return like that.

Thank you ahead of time.

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.
April 25, 2022

Welcome to the Atlassian Community!

This is something we can't really help you with.  You are working with Jira data, yes, but you've copied it out to your own database, probably in a different structure, and you're using R to query that.  A lot of us don't know R, and none of us know what structures you have built in the database.

While we could help you with your data extracts from Jira (starting with the recommendation that you do it via REST, not reading the database), we probably can't help you with your R or your reporting database.

Michael A Orozco April 25, 2022

Actually I was talking about the specifics of how I am getting the data. What I am really needing is a way to modify the data in postgres using postgres sql. 

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.
April 26, 2022

We can't help you with that - you've not told us what you have got set up in your database, and we're not R coders.

(If you are talking about writing data into Jira's database, then stop and redesign your project - you should never write to a Jira database)

Michael A Orozco April 27, 2022

I found someone to help me. We had to add some replace( regex stuff to it, and it worked.

Suggest an answer

Log in or Sign up to answer