Rally Software

Expand all | Collapse all

How to query multiselect custom field using contain part of the allowedvalues?

Jump to Best Answer
  • 1.  How to query multiselect custom field using contain part of the allowedvalues?

    Posted 09-06-2017 01:01 PM

    How to build a query in the "Custom List" that uses a custom field type multiselect and I want to make a "contains" on a certain part of the allowedvalue string.

     

    e.g. Custom List Vehicle Type have following values among many. 

    • Car - Convertible
    • Car - SUV
    • Car - Sedan
    • Car - Wagon
    • Truck - Std. Cab
    • Truck - Ext- Car

     

    I would expect to be able to get all workitems returned that is assigned to the allowedvalues that contains "Car" using below query in the custom list app.

     

    (c_Vehicle contains "Car")

     

    or 

     

    (c_Vehicle containsany "Car")

     

    However, this does not work, the only way to get all items assigned to values that contians "Car" is to create an OR query that lists all of the values that contains "Car" e.g. ((c_Vehicle contains "Car - SUV") or (c_Vehicle contains "Car Wagon"))

     

    Any one who knows how to do that...  Note, it is possible to use contains on Tags.Name, but seems not to work on multidropdown...



  • 2.  Re: How to query multiselect custom field using contain part of the allowedvalues?

    Posted 09-06-2017 02:56 PM

    I haven't tested this exact scenario but see if these works better for you.

     

    (c_VehicleType.DropDownField contains "Car")

     

    Correction: I just tested it, and it works great in the Excel Add-in and in Rally/Agile Central. 



  • 3.  Re: How to query multiselect custom field using contain part of the allowedvalues?

    Posted 09-06-2017 03:56 PM

    I get below message when using the ".DropDownField" in the query field in the Custom List App.

    Could not parse: Attribute "DropDownField" on type AllowedAttributeValue is not allowed in query expressions



  • 4.  Re: How to query multiselect custom field using contain part of the allowedvalues?

    Posted 09-06-2017 03:38 PM

    I get below message when using the ".DropDownField" in the query field in the Custom List App.

    Could not parse: Attribute "DropDownField" on type AllowedAttributeValue is not allowed in query expressions



  • 5.  Re: How to query multiselect custom field using contain part of the allowedvalues?

    Posted 09-06-2017 03:41 PM

       Is the name of the drop down "Vehicle"? if so drop the "Type"

    (c_Vehicle.DropDownField contains "Car")



  • 6.  Re: How to query multiselect custom field using contain part of the allowedvalues?

    Posted 09-06-2017 04:59 PM

    I don't have an actual Multi-Value Drop-Down List set up yet to test myself, but I wonder if using MultiValueField would work?

    (c_Vehicle.MultiValueField contains "Car")



  • 7.  Re: How to query multiselect custom field using contain part of the allowedvalues?
    Best Answer

    Broadcom Employee
    Posted 09-07-2017 04:43 PM

    Hi Nielsen,

     

    Unfortunately the "contains" operator with multi-value drop downs does not work the way you might expect it to and still requires you to pass the entire string for each value. The example below does not really solve your issue in this case but it does make for a little cleaner query. Using the "containsany" operator works like and "OR" where each value is comma separated. We also have the "containsall" operator which acts as a comma separated "AND".

     

    I hope that is helpful to you.

     

    (c_VehicleType containsany "Car - Wagon,Car - SUV")



  • 8.  Re: How to query multiselect custom field using contain part of the allowedvalues?

    Posted 09-07-2017 04:49 PM

    Hi

     

    That is very helpful, thanks for the contains any. However I find it inconsistent that can't do contain on parts of the values in a multiselect dropdown. You can on the Tags.Name field, which seems very similar to multiselect dropdown.

     

    Thomas



  • 9.  Re: How to query multiselect custom field using contain part of the allowedvalues?

    Broadcom Employee
    Posted 09-07-2017 05:08 PM

    I agree it is counter intuitive but that is the way the code was written for that particular field.