Query work items directy on sql database incase wiql - tfs

Because fetch work items from wiql that is very low. I would like to fetch them from database directly but I don't know which table should I get them?

there are 9 views that are intended for creating reports in TFS 2012:
CurrentWorkItemView
WorkItemHistoryView
BuildChangesetView
BuildCoverageView
BuildDetailsView
BuildProjectView
CodeChurnView
RunCoverageView
TestResultView
Please find more info at http://blogs.msdn.com/b/granth/archive/2010/05/09/tfs2010-how-to-query-work-items-using-sql-on-the-relational-warehouse.aspx

Related

Delphi FireDAC: how to refresh data in cache

i need to refresh data in a TFDQuery which is in cached updates.
to simplify my problem, let's suppose my MsACCESS database is composed of 2 tables that i have to join.
LABTEST(id_test, dat_test, id_client, sample_typ)
SAMPLEType(id, SampleName)
in the Delphi application, i am using TFDConnection and 1 TFDQuery (in cached updates) in which i join the 2 tables which script is:
"SELECT T.id_test, T.dat_test, T.id_client, T.sample_typ, S.SampleName
FROM LABTEST T
left JOIN SAMPLEType S ON T.sample_typ = S.id"
in my application, i also use a DBGrid to show the result of the query.
and a button to edit the field "sample_typ", like this:
qr.Edit;
qr.FieldByName('sample_typ').AsString:=ce2.text;
qr.Post;
the edition of the 'sample_typ' field works fine but the corresponding 'sampleName' field is not changing (in the grid) after an update.
in fact it is not refreshed !
the problem is here: if i do refresh of the query, an exception is raised: "cannot refresh dataset. cached updates must be commited or canceled
and batch mode terminated before refreshing"
if i commit the updates, data will be sent to database and i don't want that, i need to keep the data in cache till the end of the operation.
also if i get out of the cache, data will be refreshed in the grid but will be sent to the database after qr.post and i don't want that.
i need to refresh data in the cache. what is the solution ?
Thanks in advance.
The issue comes down to the fact that you haven't told your UI that there is any dependency on the two fields - it clearly can't know how to do the join itself without resubmitting it so if you don't want to send the updates and reload you will have a problem.
It's not clear exactly what you are trying to do, but these two ideas may help you.
If you are not going to edit the fields in the SAMPLEType tables (S) then load the values from that table into a lookup table. You can load this into a TFDMemTable. You can use an adapter which loads from a query. Your UI controls can then show the value based on the valus looked up in your local TFDMemTable. Dependiong on the UI control this might be a 'LookupField' or some such.
You may also be able to store your main data in a TFDMemTable with an Adapter - you can specify diferent TFDCommands to read the whole recordset, refresh a record, update, insert and delete a record. The TFDCommands can act on multiple tables for joined recordsets like this. That would automatically refresh the individual record for you when you post it.

TFS Query: Can I compile a query to produce a list of any WorkItems I modified?

I would like to get a list of any WorkItems I modified in TFS using TFS query builder. Including status changes I made, "assinged to" changes and including those I made posts in History.
That looks to me like pretty basic and logical query, but couldn't fiugre out how to do that.
We're using the TFS web interface, but I guess it's identical to the query builder in VS's Team Explorer.
You can get all the work items you modified with the "Changed By" field (with “Was Ever” = your username):
This query returns all the work items you modified any field (State, Assigned To, etc.), but you can't create a query to get only work items when you changed them only specific fields.

Add more than current iteration to your queries view (TFS 2018)

Anybody who knows if it possible to configure the queries view to show more than the current iteration.
Yes, it possible. You can do next:
Create new folder for queries.
Edit existing query.
Save that query to new destination.
Also you can use Group clauses
Additional information you can find here: https://learn.microsoft.com/en-us/vsts/work/track/using-queries

How to get numbers of code line change in TFS?

I'm looking for a way in TFS, I need to get the numbers of Code line change for individual developer between 2 dates, do you think it is doable via TFS?
Any help is appreciate, thanks!
Look in the TFS data warehouse. There is a FactCodeChurn table that should contain the data you're after.
You can use below SQL query statement:
SELECT TeamProjectProjectNodeName
,checkedinbyname
,SUM([LinesAdded]) AS
,SUM([LinesModified]) AS
,SUM([LinesAdded]+[LinesModified]) AS
,CONVERT(VARCHAR(10), MIN(DateTime),120) AS
,CONVERT(VARCHAR(10),MAX(DateTime),120) AS
FROM [Tfs_Warehouse].[dbo].[CodeChurnView] WHERE TeamProjectProjectNodeName='xxx' AND ChangesetTitle NOT LIKE 'xx' AND FilenameFileExtension IN('.css','.cs','.aspx','.sql','js','.ascx') AND (LinesDeleted <>0 OR LinesModified<>0 OR FilenameFilePath LIKE '$/XX' AND FilenameFileExtension IN('.sql')) AND NetLinesAdded>=0 GROUP BY TeamProjectProjectNodeName, checkedinbyname
ORDER BY DESC
Note: You must have permission to access the Tfs_Warehouse database to execute the above statement.

TFS Build data from TFS_Analysis

I need to fetch all build records with following fields, BuildName, VersionNo, BuildDate & BuildStatus from TFS_Analysis. Can someone help me to write MDX query for this.
Am unable to see BuildStatus field in TFS_Warehouse DB hence trying to get it from TFS_Analysis.
It looks a little bit like sql but the way things work are a world apart from sql. The following is complete guess work as there is not much detail in your question!...
SELECT
[Measures].[SOMEMEASUREINCUBE] ON 0
,
[BuildName].[BuildName].MEMBERS*
[VersionNo].[VersionNo].MEMBERS*
[BuildDate].[BuildDate].MEMBERS*
[BuildStatus].[BuildStatus].MEMBERS ON 1
FROM TFS_Analysis;

Resources