Rally - WSAPI: Queries do not support variables on the right hand side
search cancel

Rally - WSAPI: Queries do not support variables on the right hand side

book

Article ID: 131936

calendar_today

Updated On:

Products

CA Agile Central On Premise (Rally) CA Agile Central SaaS (Rally)

Issue/Introduction

The syntax in the following queries executed directly in WS API or in a custom grid will not  work  and shown here as examples only:

 

(CreationDate < ClosedDate)
(FixedInBuild =  FixedInBuild)
(CreationDate < Release.ReleaseStartDate)

Environment

Release:
Component: ACPREM

Resolution

The query syntax is not a programming language, and it does not accept variables.

 

Even though this is a valid syntax:

 

(Iteration.StartDate <= today)

 

"today" is a special case and there should be no expectation that in more general cases a right hand side is expected to be anything other than a literal string when using the interactive part of the WS API documentation or
endpoints or custom grids.

 

However it is be possible to successfully achieve the result expressed by the unsupported syntax used in the examples above as long as it is done in a custom code.

 

Let's say we want to filter user stories or defects by release and further filter them by CreationDate so that only the stories created prior to the Release StartDate are included in the result.
We can write a custom AppSDK2 app with a Release combobox. When a user selects a release from the dropdown, the code grabs the ReleaseStartDate of that selected release and saves it into a variable (after converting into a ISO format):

 

var releaseStart = Rally.util.DateTime.toIsoString(release.get('ReleaseStartDate'),true);


Then stories scheduled for the selected release are further filtered by this condition:

 

{
        property : 'CreationDate',
        operator : '<',
        value : releaseStart
}

 

The code that illustrate this example is availabe in github repo here.


Finally, per WS API documentation:

 

 

Query Syntax
A query is composed of a left-hand-side (LHS), an operator and a right-hand-side value (RHS). The LHS can either be the name of an object attribute ("Name" for example) or it can be another query. If the LHS of a query is an attribute name, the RHS must be a value that's legal to compare to that attribute.
For instance, the Defect type has the attributes Name and TargetBuild. The following are examples of valid queries:

(Name contains "foo")
(TargetBuild = "12345")
((Name contains "foo") and (TargetBuild = "12345"))