Getting latest non-null ItemCommentType for Project, how to (On Prem, Web API, C#)
The other thing that our users do is set the “Project Health” via ItemComment + ItemCommentType in Project comments only… Here is a spreadsheet snip of what they use:
ItemType |
Name |
Code |
IsDefaultValue |
DisplayOrder |
IsActive |
8 |
On Time |
OT |
1 |
1 |
1 |
8 |
Danger |
D |
0 |
3 |
1 |
8 |
Warning |
W |
0 |
2 |
1 |
And BTW, these are the only 3 ItemCommentType rows w/ItemType = 8 (project).
So in my Project.GetActive API call I need to get the latest ItemCommentType.Name where it is not NULL. There are numerous ItemComments w/o an ItemCommentType and they look like notations for Project attributes:
"CommentBody": "[Duration changed from: 568d to: 569d] <br/>
"CommentBody": " [Duration changed from: 563d to: 568d]<br/>[Work Hours changed from: 523.50 to: 531.50]<br/>
…
That means that the latest Project Comment with an ItemCommentType has my “Project Health”, one of the 3 values in the spreadsheet snip above.
So how do I get that via the API? I can do it via a T-SQL query J Just don’t know how via the API…
-
Hello Gary,
There is no "WHERE" type clause for the Project.GetActive method. Most REST 'Get' calls don't support that feature, since they are meant to retrieve data quickly.
I reviewed the Project.Search documentation to see if there is a filter method to retrieve by ItemCommentType, but there is no filter option for that method.
You could return all the objects and then loop through if you needed to select the projects with the correct ItemCommentType you're looking for within your application and/or tool.
Let me know if you have any other questions.
Thanks,Robert
0 -
Robert,
Thanks, and I'll do it using the brute force method.
Appreciated,
G
0
Please sign in to leave a comment.
Comments
2 comments