fieldCount JQL Function Documentation
Overview
The fieldCount JQL function allows you to count occurrences of a specified field or non-field property (such as attachments, worklogs, comments) within a set of issues defined by a JQL subquery. This function is useful for filtering issues based on the number of occurrences of a particular field or property.
Key Features
- Field Counting: Count occurrences of standard Jira fields (e.g., labels, assignee).
- Non-Field Property Counting: Count occurrences of non-field properties such as attachments, worklogs, and comments.
- Custom Fields Support: The function also supports custom fields, allowing you to count occurrences of any field defined in your Jira instance.
- Flexible Operators: Supports various operators (
=,!=,>,<,>=,<=) to filter issues based on the count. - JQL Integration: Seamlessly integrates with Jira Query Language (JQL) for complex queries.
How to Use
To use the fieldCount function, you need to construct a JQL query that includes the fieldCount function. The syntax is as follows:
issue [operator] fieldCount("subquery", "fieldName", count)
Parameters:
- subquery: A valid JQL query that defines the set of issues to evaluate.
- fieldName: The name of the field or non-field property to count.
- count: The number of occurrences to compare against.
Examples:
-
Finding Issues with Exact Number of Labels:
issue = fieldCount("project = CITEST", "labels", 3) -
Finding Issues with No Parent:
issue > fieldCount("project = CITEST", "Parent", 0) -
Finding Issues with Assignee:
issue = fieldCount("project = CITEST", "assignee", 1) -
Finding Issues with Attachments:
issue = fieldCount("project = CITEST", "attachments", 2) -
Finding Issues with Worklogs:
issue = fieldCount("project = CITEST", "worklogs", 2) -
Finding Issues with Comments:
issue = fieldCount("project = CITEST", "comments", 2)
Input and Output Details
- Input: The
fieldCountfunction takes a subquery, a field name, and a count as input. - Output: The function returns a set of issues that match the specified count criteria.
Configuration and Dependencies
- Ensure that your Jira instance is configured to support JQL queries.
- The
fieldCountfunction requires theevaluateExpressionsAndCollectResultsfunction from the Jira expressions module.
Jira-Specific Information
- Switching to JQL Mode: In the Issue Navigator, you can switch from basic to JQL mode to utilize the
fieldCountfunction. - Valid JQL Subquery: The subquery provided to
fieldCountmust be a valid JQL query. This ensures that the function operates correctly within the Jira environment.
Conclusion
The fieldCount JQL function enhances the flexibility of Jira queries by allowing users to filter issues based on the count of specific fields or properties. By following the usage instructions and understanding the input/output details, you can effectively utilize this function in your Jira workflows.