Wikis - Page

Is it possible to count the number of items in a View?

0 Likes

Problem:

Is it possible to count the number of items in a View?

Resolution:


  • Product Name: StarTeam
  • Product Version: All
  • Product Component: Database
  • Platform/OS Version: N/A


This is possible by querying the StarTeam database. To find the View ID you need , run the query below:

SELECT ID, Name FROM syn_View

To query the number of items in a view run the query,

SELECT COUNT(ViewID)
AS [number of view items]
FROM syn_ViewMember
WHERE (ViewID = 12345)

Replace 12345 with a View ID value from the previous query.

To identify how many items in the view are files, CR, etc.. run the query,

SELECT COUNT(ViewID)
AS [number of view items]
FROM syn_ViewMember
WHERE (ViewID = 0)
AND ClassID=(Select Id from CTables where StName ="File")

This will reveal the count of all items which are files.

You could expand this further to include other items such as CR, folders etc.. as shown below:

SELECT COUNT(ViewID) AS [number of view items]
FROM syn_ViewMember
WHERE (ViewID = 0)
AND (ClassID IN (SELECT ID FROM CTABLES WHERE (STNAME IN ("File", "Folder", "Change"))))

Values for STNAME can be retrieved from the CTables table.


Old KB# 29097
Comment List
Related
Recommended