Swiftorial Logo
Home
Swift Lessons
Matchups
CodeSnaps
Tutorials
Career
Resources

Advanced JQL Tutorial

Introduction

Jira Query Language (JQL) is a powerful tool that allows users to perform complex queries on Jira issues. This tutorial will guide you through advanced JQL concepts and demonstrate how to create sophisticated filters to help you manage and analyze your issues efficiently.

Basic JQL Recap

Before diving into advanced JQL, let's quickly recap the basic JQL structure. A simple JQL query consists of a field, an operator, and a value. For example, to find all issues assigned to a specific user, you can use:

assignee = "username"

Using Advanced Operators

Advanced JQL allows the use of operators like IN, NOT IN, IS, WAS, and CHANGED. These operators provide more flexibility in filtering issues.

IN and NOT IN

The IN operator is used to search for issues where the field value is within a specified list. Conversely, the NOT IN operator finds issues where the field value is not in the list. For example, to find issues with specific priorities:

priority IN ("High", "Medium")

To exclude these priorities, use:

priority NOT IN ("High", "Medium")

Using Functions

JQL provides several built-in functions to perform complex queries. Some commonly used functions are currentUser(), now(), and startOfWeek(). Let's explore these functions with examples.

currentUser()

This function returns the current logged-in user. For example, to find all issues assigned to the current user:

assignee = currentUser()

now()

The now() function returns the current date and time. You can use it to find issues created in the last 24 hours:

created >= -1d

startOfWeek()

This function returns the start of the current week. To find issues created since the start of the week:

created >= startOfWeek()

Combining JQL Clauses

Advanced JQL allows you to combine multiple clauses using AND, OR, and parentheses. This enables you to create more specific and powerful filters.

AND and OR

The AND operator combines clauses to find issues that match all specified criteria. For example, to find high-priority issues assigned to a specific user:

priority = "High" AND assignee = "username"

The OR operator finds issues that match any of the specified criteria. For example, to find issues that are either high priority or assigned to a specific user:

priority = "High" OR assignee = "username"

Using Parentheses

Parentheses help group clauses to control the order of evaluation. For example, to find issues that are either high priority and assigned to a specific user or low priority:

(priority = "High" AND assignee = "username") OR priority = "Low"

Ordering Results

JQL allows you to order the results using the ORDER BY clause. You can sort issues by fields such as priority, assignee, or creation date. For example, to order issues by priority and then by creation date:

ORDER BY priority ASC, created DESC

Subqueries

Subqueries allow you to perform nested queries, providing more advanced filtering options. For example, to find issues in a specific project that are linked to issues in another project:

project = "PROJ1" AND issue in linkedIssues("PROJ2-123")

Conclusion

Advanced JQL provides powerful tools to create complex queries, allowing you to manage and analyze issues more effectively. By mastering advanced operators, functions, combining clauses, ordering results, and using subqueries, you can unlock the full potential of JQL in Jira.