locked
"In" operator in Work Item query doesn't work RRS feed

  • Question

  • I try to use the "In" operator in a Work Item query in VSTS but it doesn't work!!?? I do something like this: "Work Item Type    In    Bug,Feature"

    But I don't get any results.

    On the MSDN site the following help info tells that what I try to do is legal.

    To query several team projects

    1. In the first query clause, enter the values shown in the following table:

       
      And/Or Field Operator Value

       

      Team Project

      In

      <first team project name>, <second team project name>, ...

      Separate the team project names with commas (,).

     

    Can somebody tell me what's wrong

    AJdH.

     

     

    Tuesday, April 25, 2006 11:46 AM

Answers

  • The seperator used by the query editor WIQL parser in Visual Studio is senstive to region settings.

    If you go to Control Panel, Regional and Language Options, Customize...

    The value used as the "List separator" is what is used to seperate lists in the IN statement. This should probably be made clearer in the MSDN documentation but I'm not sure how that is localised.

    The seperator get's coverted into the WIQL comma notation before it is passed on to the server so if you list is "a;b;c" in Query Editor (because ";" is your list delimeter) then the server is still sent a WIQL string of  'a','b','c'

    Hope this helps,

    Martin.
    Tuesday, April 25, 2006 1:26 PM
    Moderator
  • I'm doing the following in the IDE and it works fine:

    Work Item Type      In     Task, Change Request

    If you're programming in WIQL, you need to do something like this:

    SELECT [System.Id], [System.WorkItemType], [System.State], [System.AssignedTo], [System.Title]
    FROM WorkItems
    WHERE [System.WorkItemType] IN ('Bug', 'Task')
    ORDER BY [System.WorkItemType], [System.Id]

    -Larry

     

    Tuesday, April 25, 2006 12:00 PM

All replies

  • I'm doing the following in the IDE and it works fine:

    Work Item Type      In     Task, Change Request

    If you're programming in WIQL, you need to do something like this:

    SELECT [System.Id], [System.WorkItemType], [System.State], [System.AssignedTo], [System.Title]
    FROM WorkItems
    WHERE [System.WorkItemType] IN ('Bug', 'Task')
    ORDER BY [System.WorkItemType], [System.Id]

    -Larry

     

    Tuesday, April 25, 2006 12:00 PM
  • Hi Larry,

    Thanks for your quick reaction, but how can I export my queries to the format you used in your answer and how can import them back in VSTS. Is there a DOS command tool something like WIQEXPORT and WIQIMPORT?

    AJdH

    Tuesday, April 25, 2006 12:29 PM
  • I actually just edited my response, because I realized you were in the VSTS IDE and not trying to do it programatically.

    So when I do the following in the Work Item Query screen in the IDE it works:

    Work Item Type      In     Task, Change Request

    This seems similar to what you're doing, so I don't know what it could be.  You might try putting a space after the comma (i.e. Bug, Feature) but eliminating the space in my clause worked as well.

    -Larry

     

     

    Tuesday, April 25, 2006 12:37 PM
  • When I use the ; separator in stead of the , separator between the keywords in the list then it works.

    Work Item Type    In   Bug;Feature;Task

    Thanks for your help.

    Arie-Jan

    Tuesday, April 25, 2006 12:47 PM
  • The seperator used by the query editor WIQL parser in Visual Studio is senstive to region settings.

    If you go to Control Panel, Regional and Language Options, Customize...

    The value used as the "List separator" is what is used to seperate lists in the IN statement. This should probably be made clearer in the MSDN documentation but I'm not sure how that is localised.

    The seperator get's coverted into the WIQL comma notation before it is passed on to the server so if you list is "a;b;c" in Query Editor (because ";" is your list delimeter) then the server is still sent a WIQL string of  'a','b','c'

    Hope this helps,

    Martin.
    Tuesday, April 25, 2006 1:26 PM
    Moderator
  • That explains it.  Thanks!! 

     

    Tuesday, April 25, 2006 1:29 PM
  • I've elaborated this in a blog post for those that are interested:-

    http://www.woodwardweb.com/vsts/000228.html

    Regards,

    Martin.
    Tuesday, April 25, 2006 3:19 PM
    Moderator
  • That's great, thanks!  And now I know how to pronounce WIQL (Wickle). 

    Tuesday, April 25, 2006 6:49 PM
  • Arie-Jan said:

    Hi Larry,

    Thanks for your quick reaction, but how can I export my queries to the format you used in your answer and how can import them back in VSTS. Is there a DOS command tool something like WIQEXPORT and WIQIMPORT?

    AJdH




     Just open the *.wiq file in Visual Studio, choose save as and than choose to save it to your project as team query or my query.
    ReF
    Friday, February 13, 2009 10:13 AM