Skip to main content
Skip table of contents

Adding sum-array helper

This helper sums up numeric values together, for example to get a combined duration value of selected entries use:

CODE
{{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.

CODE
{{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

CODE
{{#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}}
JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.