filter_sum (zotonic_mod_base v1.0.0-rc.17)

Sum a list of numbers.

This filter calculates the sum of all numeric values in a list. Non-numeric values are automatically filtered out.

For example:

    {{ [1, 2, 3, 4, 5] | sum }}

Results in 15.

When applied to a list with mixed types:

    {{ [10, 20, "text", 30] | sum }}

Results in 60. The string "text" is ignored.

If the input is undefined, the filter returns undefined.

This filter is useful for analytics and reporting, such as summing values extracted from lists of maps or resources.

Summary

Functions

sum/2