Sum of all numeric values present in a custom form field using collection | Community
Skip to main content
March 19, 2024
Solved

Sum of all numeric values present in a custom form field using collection

  • March 19, 2024
  • 1 reply
  • 869 views

Hi All,

 

I have a similar situation where I need to check a numeric field of a Custom form which is created at issue level. 

 

 

valueexpression=IF({DE: Audit Type}="Design" && {DE: Audit Phase}="Post-go-live audit", {DE: PROD Audit Error Count}) listmethod=nested(issues).lists valueformat=HTML displayname=Total PROD Errors textmode=true type=iterate

 

Here I'm getting the output something like this; 4,6,8

However, I would like to sum all the values i.e., 4+6+8 = 18. 

 

Would appreciate any help on this matter.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by KellieGardner

As you've discovered you won't be able to do calculations on collections within a reporting column.

 

Your best option is going to be to create a calculated field on your custom form to capture that data and then pull it into the report. 

1 reply

March 19, 2024

Just for the records, I've thoroughly reviewed all available documentation and haven't found a solution to this issue yet. While working with collections in WORKFRONT, it seems we don't have an option to sum all iterated values directly. However, considering that a collection is essentially an array without any index, it should theoretically be possible to sum all its values.

 

For instance, if I obtain the output as 4, 6, 8 using the code I've shared, I'm considering adding another column. From there, I could potentially utilize the values (4, 6, 😎 from this column, remove the delimiters, create a array, and then sum all the values in the array.

  • Would this approach be feasible? 
  • Can we use array functions in text mode?

I have recently started working on Workfront so apologies if this sounds a naive question.

KellieGardner
Community Advisor
KellieGardnerCommunity AdvisorAccepted solution
Community Advisor
March 19, 2024

As you've discovered you won't be able to do calculations on collections within a reporting column.

 

Your best option is going to be to create a calculated field on your custom form to capture that data and then pull it into the report. 

March 25, 2024

Thank you @31867! I also thought about that but it is not feasible in my case given.