TFS WIQL Query condition with item's parent field - tfs

I need to query that hierarchical structure:
Feature 1
Feature 2
PBI 1 - Title A
PBI 2 - Title X
Feature 3
PBI 2
I want to get Feature 1 and under Feature 1 I check its child items by child item title and also I want to get this child item's items due to their title. Is it possible to write something like that? Basically I need a recursive query down to up.WorkItem.Title='something' and WorkItem.Parent.Title='something'.
SELECT * FROM WorkItemLinks
WHERE ([Source].[System.TeamProject] = #project
AND [Source].[System.WorkItemType] In('Feature','Product Backlog Item')
AND [Source].[System.State] <> ''
AND [Source].[System.Title] = 'Feature1')
AND ([System.Links.LinkType] = 'System.LinkTypes.Hierarchy-Forward')
AND ( [Target].[System.State] = 'New'
AND [Target].[System.WorkItemType] In('Feature','Product Backlog Item')
AND ( [Target].[System.Title] = 'Title A' or **[Target].[System.Title].Parent='Feature2'

Yes, you can use Tree Query to achieve this.
A easy way to do this is creating the query directly in the web portal. A simple example like following:
And you can check the WIQL code for the query via Rest API if you want to use it:
Update:
You can add a filter in "Filters for linked work items" and use "Or" for the two filters as following if you want "Workitem.Title=PB1 or WorkItem.Parent.Title =Feature":

Related

How to restrict TFS item links to a specific type?

I have the following tfs wiql query that returns me an item and all linked items (child, related, etc.):
var query = string.Format("SELECT * FROM WorkItemLinks WHERE " +
"Source.[System.Id] IN ({0}) " +
"AND (Target.[System.State] <> 'Deleted'" +
"AND (Target.[System.WorkItemType] = 'eScrum Sprint Task' OR Target.[System.WorkItemType] = 'Bug') " +
"AND Target.[System.Title] not contains 'css') mode(MayContain)", storiesRange);
How to restrict this query so that it returns linked items only of child type?
If you have no idea how to write some WIQL for your customized work item query.
You could first use visualization window to create your work item query in web portal UI.
Such as below:
Then save the query and open the query in visual studio. Or you could use some 3-party extension such as this one-- Wiql Editor
It will directly transfer the work item query to WIQL language. For example the WIQL of above query should be:
So according to above info to restrict this query so that it returns linked items only of child type, you should add this restriction:
[System.Links.LinkType] = 'System.LinkTypes.Hierarchy-Forward'
Just add this:
AND ([System.Links.LinkType] = 'System.LinkTypes.Hierarchy-Forward')

Create a query params with combobox in Foxx

I wonder if I can create a query param that take multiple values from dropdown just like a non-typing combobox in the UI of ArangoDB. For example
//A route....
.queryParam('A', joi.any().allow(["true","false,"haha"]).required().default("true"))
The one above produce an dropdow that allow you to choose only 1 value. Is it possible to make them behave like a combo box on arango's UI?
I use this query param join's validation that shows as a drop down in the Arango UI
.queryParam('direction', joi.string().lowercase().valid('inbound', 'outbound', 'any')
.required().description('Direction of traversal from given product (inbound/outbound/any)'
))

SSRS Filter on 2nd list

I have two SharePoint lists that have “RequestID” in common. The primary list for the report is “Action Items”, but I only want to see those records where the Application equals the selected parameter. The Application is in the “Requests” list.
I want to filter for the Application name = 'Math', so in this case, I would only get Action Item Ids 44 and 55 which relate to Requests #15 and #22.
I have successfully displayed the name of the application in the report using this:
=Join(LookupSet(CInt(Fields!Request_ID.Value), CInt(Fields!ID.Value), Fields!Application.Value, "Requests"), ", ")
But, I understand that you cannot use a Lookup in a filter. Any ideas?
It sounds like you should be using Cascading Parameters to do what you want.
With Cascading Parameters, you select the Application in one parameter and then base the selection for the Action Items parameter that uses the Application parameter.
With SQL you could filter the dataset for the ActionItemIDs:
SELECT ActionItemID
FROM ACTION_ITEMS
WHERE REQUEST_ID IN (SELECT REQUEST_ID FROM REQUESTS WHERE APPLICATION = #APPLICATION_PARAMETER )
But you can FILTER the Action Item SharePoint list on the DataSets FILTER tab:
Expression:
=IIF(INSTR(
Join(LookupSet(Parameters!#APPLICATION_PARAMETER.Value, Fields!Application.Value, Fields!ID.Value, "Requests"), ",") & ","
, Fields!Request_ID.Value & ",") > 0, 1, 0)
This looks for the Request ID being in the list (from the LookUp [15,22,]) of ID with the Parameter (MATH) as the App.
https://technet.microsoft.com/en-us/library/aa337169(v=sql.100).aspx
https://technet.microsoft.com/en-us/library/aa337498(v=sql.105).aspx

How to get the list of ChangesetIDs in an iteration path from source control?

I want to get the list of changes (i.e. the ChangeSetID's) associated with an iteration path.
Is there a way we can get the list of them ?
As long as you link your changesets to your work items!
There is no direct relationship between a check-in and an iteration except where it is created. When your developers check-in they get the option to relate their check-in to one or more work items within the work item tracking system. so:
Iteration -> Work Item -> Changeset
So in order to retrieve your list of changesets associated with your iteration you:
User the API to query for all work items where [System.Iteration] Under "[project]\Release 1\Sprint 1"
Loop through each work item returned and return all changeset links
I hope this helps you...
Code paraphrased:
To get Work item Store
_store = collection.GetService<WorkItemStore>();
To get Query Results
_store.Query("SELECT [System.Id], [System.WorkItemType], [System.Title], [System.AssignedTo], [System.State] FROM WorkItems WHERE [System.TeamProject] = #project AND [System.IterationPath] UNDER 'TfsExtensions\TfsFieldAnnotate\Release 1' ORDER BY [System.Id] ")
Each work item then contains "wi.Links" and you should be able to find the Changeset Lin Type easily...

TFS Query - History section - comments added by date

How do I write a query in TFS to show me users that have added comments in the history section of a work item in the past 2 days?
Team Project = # Project
And Work Item Type = [Any]
And History Contains MY_KEY_PHRASE
And Changed Date >= #Today - 2
Since Contains cannot be null we have to add a value to the History search.
MY_KEY_PHRASE = Whatever you want to put in your comments field, as a standard, to identify changes (such as "comments" or "cc" or "." etcetera).
The easiest solution is to use prefix before any comments, so any one need to write comments just write "Comments:" keyword followed by carriage return before his comments and then
Edit the query
Add new criteria as the following:
(And/Or)--> And
(Field)---> History
(Operator)--> Contains
(Value)--> Comments
Thanks
M.Radwan

Resources