Query language

To create complex filters that use OR conditions, negation, and other features not provided by simple filters, use a query language. To write a complex filter, enter a question mark in the filter line, after which the system will prompt you to select an attribute for filtering, a logical operation, or specify a value for the filter.

Query language syntax

The query consists of the logical operators AND, OR, NOT, equality and inequality operators, and a selection operator from the IN set. To search for the type "contains", use the tilde character. You can use boosting the priority of a logical operation using parentheses. You must leave a space between operands and values.

The left operand is the path to the attribute. In a simple case, this is the system name of the attribute, for example, Caption. The system prompts you which attributes you can select. The full set of attributes is also available in the Developer's Reference module.

Id is an attribute containing the object's identifier. For example, the expression ?Id = 123 is used to filter data by a specific object ID.

Some attributes are references to other objects. To access them, use the dot symbol. For example, the expression ?Project.CodeName = "test" will select data for a specific project.

If you need to use the name of an object in the filter, then the Caption attribute can be omitted. For example, the expression ?Tags = “one” AND NOT Tags = “two” will select data that contains a tag called “one” and no tag called “two”.

The right operand is a scalar value (a number or text specified in quotes).

When using the IN operator, the values are listed separated by commas, for example IN "one, two, three"

The right operand can also be an object attribute. For example, the expression ?Planned< Fact allows you to select tasks for which actual labor costs exceeded planned ones.

There are several built-in keywords that can be used as the right operand:

  • user - current user. For example, the expression ?Author = user will allow you to select objects where the current user is specified as the author.
  • project - current project. For example, the expression ?Project = project will select objects only in the current project.

When specifying a date, you can use relative expressions, for example, now - today, “-1 days” – “yesterday”.

You can specify the sorting of results in search queries. To do this, add the ORDER BY clause at the end and specify the system name of the attribute. The sorting direction is specified by the phrases ASC - for forward sorting and DESC - for reverse sorting. To sort by multiple fields use a comma, for example ORDER BY Caption ASC, Email DESC

Example requests:

  • Issues with text in the title:
    ?Caption ~ “text”
  • Current iterations:
    ?FinishDate > now
  • Issues or User stories where the current user is the performer or is among the observers:
    ?Owner = user OR Watchers.SystemUser = user
  • Requirements of certain types:
    ?PageType.ShortCaption IN “VI,ST”
  • Requirements that have test cases associated with them:
    ?TestScenario.Id != ""
  • Requirements are tested, but not covered by test documentation:
    ?PageType.IsTesting = "Y" AND NOT TestScenario.Id != ""
  • Requirements for which the test results are "Failed":
    ?LatestTestCaseExecution.Result.ReferenceName = "failed"