cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X

Project level computed expression for summing up document level field

BaluS
7-Bedrock

Project level computed expression for summing up document level field

At the Project level, I need to follow the "Documented By" relationship field, and calculate the "Last Week Document Churn" from Requirement Specification Documents and Test Protocol Documents, separately.

 

Below expression gives total for all documents in the "Documented By" relationship field.

<%compute%>aggregateByTree("Documented By",sum("Last Week Document Churn"))<%endcompute%>

Is there a way to add a type constraint (e.g. Type == "Requirement Specification Document"). I tried, but they all give syntax errors.

 

Can someone please help me?

 

Thank you,

Balu

1 ACCEPTED SOLUTION

Accepted Solutions
BaluS
7-Bedrock
(To:BaluS)

Came up with below computed expressions for computing Last Week Document Churn, separately for Requirement Spec Docs and Test Protocol Docs, following the "Documented By" relationship field in a Project item:

 

<%compute%>aggregateByTree("Documented By", sum(isType("Requirement Specification Document") ? "Last Week Document Churn" : 0))<%endcompute%>
<%compute%>aggregateByTree("Documented By", sum(isType("Test Protocol Document") ? "Last Week Document Churn" : 0))<%endcompute%>

 

View solution in original post

2 REPLIES 2
BaluS
7-Bedrock
(To:BaluS)

I took a different approach for the computed fields, and was able to solve this. Create a regular query for your document type (e.g. "All Requirement Specification Documents"), then use it in a compute Query function in the report with "Project" as a correlation field and sum for the aggregate expression.

 

<%compute%>Query("All Requirement Specification Documents", Project, sum("Last Week Document Churn"))<%endcompute%>

<%compute%>Query("All Test Protocol Documents", Project, sum("Last Week Document Churn"))<%endcompute%>

BaluS
7-Bedrock
(To:BaluS)

Came up with below computed expressions for computing Last Week Document Churn, separately for Requirement Spec Docs and Test Protocol Docs, following the "Documented By" relationship field in a Project item:

 

<%compute%>aggregateByTree("Documented By", sum(isType("Requirement Specification Document") ? "Last Week Document Churn" : 0))<%endcompute%>
<%compute%>aggregateByTree("Documented By", sum(isType("Test Protocol Document") ? "Last Week Document Churn" : 0))<%endcompute%>

 

Top Tags