how can I create a filter with time range

Olivier Albertini August 12, 2015

I have 3 filters :

Day tickets

project = ST AND created >= "2015/08/10 7:00" AND created < "2015/08/10 17:00"

Evening tickets

project = ST AND created >= "2015/08/10 17:00" AND created <= "2015/08/10 23:00"

Night tickets

project = ST AND created > "2015/08/10 23:00" AND created < "2015/08/11 7:00"

 

I would like to know the number of tickets by day, evening, night in the month or in a week.

Is there a way to achieve this ?

I have JIRA 6.4

Plugins : EasyBI, Script runner, JIRA Workflow toolbox, JIRA Misc Custom field, JIRA Automation

2 answers

4 votes
Nicolas Bourdages
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.
August 12, 2015

First of all, thanks for including your JIRA version and your plugins in the post. So few people do that.

I'm not sure I get the meaning of your question though. You have your queries already, and they look good to me. Do you mean that you would like something dynamic and not have to specify the exact date? Something that would mean "I want to see all issues reported between 7:00 and 17:00 for the previous week"?

You can get half way there with some JQL functions built-in (startOfWeek(), startOfMonth()), but it's not like a cron pattern.

Maybe you could compose a horrible query that goes something like this: created > startOfWeek(7h) AND created <= startOfWeek(17h) OR created > startOfWeek(31h) AND created <= startOfWeek(41h)...

The query for issues in a month would be horrendous. In fact, since month length vary, you wouldn't be able to make a reliable query that works for every month.

I'm afraid you'll have to create your own JQL function using ScriptRunner, unless somebody else knows of a plugin that does more flexible queries based on times?

 

Olivier Albertini August 12, 2015

Do you mean that you would like something dynamic and not have to specify the exact date? Something that would mean "I want to see all issues reported between 7:00 and 17:00 for the previous week"? Yes exactly !

Nicolas Bourdages
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.
August 12, 2015

Yeah. That sounds like something that would be easy to do in SQL, but there's no distinct Time field, so I don't think there's a simple built-in JQL solution. If you don't mind querying the database directly, you could get the list of issues, and make a query for that list of issues in JIRA. Sounds like more work than changing the filter each week/month... I'll let you do the cost/benefits analysis: Is the added value of a permanent filter worth the time to script a custom function or use SQL to query the database directly?

Like Dmitriy Yefymenko likes this
0 votes
kbuschle May 10, 2017

I see you have EasyBI so you might be able to try this https://community.atlassian.com/t5/Questions/eazybi-time-of-day/qaq-p/378683

Suggest an answer

Log in or Sign up to answer