Custom query on Multi-Select dropdown field returns error.
search cancel

Custom query on Multi-Select dropdown field returns error.

book

Article ID: 9193

calendar_today

Updated On:

Products

Rally On-Premise Rally SaaS

Issue/Introduction

When attempting a custom query using a custom multi-select dropdown field in the custom list app I receive an error  “Cannot parse object from ….”  Even though the value passed in my query is present.

Environment

Release:
Component: ACAPI

Resolution

Partial queries against one or more of the values listed for a multi-select dropdown field will not work. 

The "contains" and "!contains" operators do not work the same way they work with other fields. With the multi-select drop down field each item in the multi select list is actually a separate object and therefore you must pass the entire string value. For Multi-select fields specifically, "contains" really means return all items where c_multilist value contains the entire string of at least one item in the list. You cannot only pass a portion of any single list item! 


To explain this another way assume you have a custom multi value list named "VehicleType" with the following list items" 

Car - Toyota 

Car - Mazda 

Car - BMW 

Truck - Chevy 

Truck - Ford 


Now assume you want to set up a custom list app with a query that only returns user stories that have any combination of the “VehicleType” multi-select values selected that contain the word "Car". 



You could not use the following query below as you could would other types of fields. In this example you would get an error similar this “Cannot parse object from Car”

This is because the query actually expects the entire string value.


(c_VehicleType contains "Car") 



This example on the other hand would work but would only return work items that contain the "Car - BMW" value selected within the multi select list. 

(c_VehicleType contains "Car - BMW") 

If you wanted to create a query which pulled all work items, which contained any of the list values that contain the word "Car" you would have to compose an “OR” query which included the entire string value of each list item that contains the work "Car". 

For example: 

(((c_VehicleType contains "Car - Toyota") OR (c_VehicleType contains "Car - Mazda" )) OR (c_VehicleType contains "Car - BMW")) 

 

 

Alternatively, long queries using AND/OR can be shortened or optimized by using the “containsall” and “containsany” operators which replaces AND/OR respectively.

Example:

 

Using the containsall operator allows a list of string values to be comma delimited using AND for each value.

( c_multidropdown containsall “value1,value2,value3,value4” )

 

Using the containsany operator allows a list of string values to be comma delimited using OR for each value.

( c_multidropdown containsany “value1,value2,value3,value4” )

 

Please note: Currently there is a defect preventing proper function of the "containsall" and "containsany" operators with the UI such as Custom List app queries. However, these two operators do work correctly via the API and the WSAPI query pages.