Adding sum-array helper
This helper sums up numeric values together, for example to get a combined duration value of selected entries use:
{{sum-array model "Duration" "formatMsToDuration"}}
where,
- sum-array is the name of the helper itself ("fixed").
- model is the model containing selected entries ("fixed").
- Duration is the metadata binding name, please see available bindings ("configurable").
- formalMsToDuration is the converter name which converts the result into HH:MM:SS:xxx format ("configurable").
Another example would be to calculate total FileSize of selected entries.
{{sum-array model "FileSize" "formatFileSize"}}
Here,
- FileSize is the metadata binding name.
- formatFileSize is the helper that converts the result into appropriate unit e.g KB, MB, GB etc.
Example Configuration
{{#form-container legacyController=legacyController}}
{{#responsive-grid-area}}
<div data-col="sm-4 xs-12 valign-sm-center valign-xs-bottom">
Total Size:
</div>
<div data-col="sm-8 xs-12 valign-center">
{{sum-array model "FileSize" "formatFileSize"}}
</div>
<div data-col="sm-4 xs-12 valign-sm-center valign-xs-bottom">
Total Duration:
</div>
<div data-col="sm-8 xs-12 valign-center">
{{sum-array model "Duration" "formatMsToDuration"}}
</div>
{{/responsive-grid-area}}
{{/form-container}}