Select to view content in your preferred language

Aggregate functions with a default value

358
1
11-28-2018 06:19 PM
JaromHlebasko
Frequent Contributor

I was wondering if someone could point me in the right direction. I have a repeat that calculates certain fields and based on that field I want to aggregate and sum up all of the users input. I can successfully do this with the aggregate sum function; However, if the user does not provide an input for that integers field, this aggregate sum function does not populate. Is there a way to assign a default value to the aggregate field of zero so at least the calculation can proceed?

Tags (1)
0 Kudos
1 Reply
by Anonymous User
Not applicable

Hi Jarom,

Yes this is possible, you can use if() statement, and if the value is null set the default as 0, otherwise use the calculated valued. Do this in the fields with calculations inside the repeats, and then the sum() function will work as expected outside the repeat to sum all the values.

Phil.

0 Kudos