Projects' Risks and Issues custom columns Querying in Project Server 2010
Working with Project Server 2010 Reporting database makes me realize how it can be painful to get information and properties that was customized on Risks or Issues sharepoint lists (or any sharepoint list).
Risks, Issues, and Deliverables are lists in the project site, yet they are project's properties. those properties have their own Tables in the project server 2010 reporting database as:
- Risks : MSP_WssRisk
- Issues : MSP_WssIssue
- Deliverables: MSP_WssDeliverable
And since they are sharepoint lists then they can be customized to add columns or update column's values. and there the trick is ... the new custom columns are added to the sharepoint content database as database columns that will be named by the data type of the property and a postfix number, in the [AllUserData] table like: datetime2, sql_variant1, nvarchar9 ...etc.
After lots of googling the way to do it I have found a blog (unfortunately I can't find it again) that suggested a query to do so, it will be like this:
SELECT B.ProjectUID, B.IssueUniqueID,....., A.datetime2 as [Date Raised]
FROM PWAContentDatabase.dbo.AllLists lists
INNER JOIN PWAContentDatabase.dbo.AllUserData as A ON lists.tp_ID = A.tp_ListId
INNER JOIN dbo.MSO_WssIssue as B ON a.tp_DocId = B.IssueUniqueID
INNER JOIN dbo.MSP_Epm_Project_UserView AS C ON B.ProjectUID = C.ProjectUID
FROM PWAContentDatabase.dbo.AllLists lists
INNER JOIN PWAContentDatabase.dbo.AllUserData as A ON lists.tp_ID = A.tp_ListId
INNER JOIN dbo.MSO_WssIssue as B ON a.tp_DocId = B.IssueUniqueID
INNER JOIN dbo.MSP_Epm_Project_UserView AS C ON B.ProjectUID = C.ProjectUID
I have tried it and it worked as charm except for one detail; consider having this daily used scenario:
- open the project site
- open the issues list (for example)
- add a new Issue
- close the Add Issue dialog
- open the Issue for edit and save again
so our final SQL query will be like this:
SELECT B.ProjectUID, B.IssueUniqueID,....., A.datetime2 as [Date Raised]
FROM PWAContentDatabase.dbo.AllLists lists
INNER JOIN PWAContentDatabase.dbo.AllUserData as A ON lists.tp_ID = A.tp_ListId
INNER JOIN dbo.MSO_WssIssue as B ON a.tp_DocId = B.IssueUniqueID
INNER JOIN dbo.MSP_Epm_Project_UserView AS C ON B.ProjectUID = C.ProjectUID
WHERE (A.tp_IsCurrentVersion = 1)
FROM PWAContentDatabase.dbo.AllLists lists
INNER JOIN PWAContentDatabase.dbo.AllUserData as A ON lists.tp_ID = A.tp_ListId
INNER JOIN dbo.MSO_WssIssue as B ON a.tp_DocId = B.IssueUniqueID
INNER JOIN dbo.MSP_Epm_Project_UserView AS C ON B.ProjectUID = C.ProjectUID
WHERE (A.tp_IsCurrentVersion = 1)
And finally,to avoid keep using the same query a lot I suggest to use this query as database view.
It worked for me I hope it will work for you as well :)
Comments
Post a Comment