Products Downloads


French version


 

This function returns the calculation result on a sequence's element values.

The sequence must be a Hash object sequence.

The applied calculation may be:

  • Calculation of the maximum element value (max);
  • Calculation of the minimum element value (min);
  • Calculation of the sum of the element values (sum);
  • Calculation of the average of the element values (avg);
  • Calculation of the number of element values (count);
  • Calculation of the number of separate element values (separatecount);
  • Calculation of the sample variance of the element values (samplevariance);
  • Calculation of the sample standard deviation of the element values (samplestandarddeviation);
  • Calculation of the population variance of the element values (populationvariance);
  • Calculation of the population standard deviation of the element values (populationstandarddeviation);
  • Calculation of the median of the element values (median);
  • Calculation of the value with the highest occurrence of the element values (mode);
  • Pearson correlation coefficient calculation between two sets of element values (pearsonscorrelation);
  • Calculation of the covariance between two sets of element values (covariance);
  • Calculation of the weighted mean of a set of element values according to another set of element values (weightedmean).


This function can be executed:

  • Either in the nested content of groupHeader/groupFooter macros. In this case the sequence of elements taken into account to apply the calculation is the sub-sequence defined by the group associated with groupHeader/groupFooter macros. To do this, the loop variable used to identify the current group in the groupHeader/groupFooter macros needs to be passed as a parameter of this macro.
  • Or outside the nested content of a groupList macro. In this case, the element sequence taken into account to apply the calculation is a sequence passed as a parameter. The calculation applies to all the elements in this sequence.


To identify the values to take into account for the calculation, a Hash object attribute name belonging to the sequence needs to be passed as a parameter. You also need to make sure that the attribute value type is compatible with the chosen calculation type.


Parameters

String

colNameToSummarize

Name of the Hash object attribute in the sequence used to extract the values for applying the calculation

Mandatory

String/Hash

computeType

Calculation type. If this parameter is String type, it must take a value from max, min, sum, avg, count, separatecount , samplevariance, samplestandarddeviation, populationvariance, populationstandarddeviation, median, mode, pearsonscorrelation, covariance, weightedmean.
If this parameter is a Hash object, it must have the following attributes:

  • fct: calculation type name,
  • linkedColName: name of the attribute used to reference the values of the second sequence when the calculation type is "pearsonscorrelation", "covariance" or "weightedmean"

 

Hash/Hash sequence

summaryLocation

When this function is used in a groupHeader/groupFooter macro, this parameter is the loop variable identifying the current group in groupHeader/groupFooter.
When this function is used outside a groupList macro, this parameter represents the sequence on which to apply the calculation.

 



For example

<#assign seqData = [{"name": "mary", "age": 18},
{"name": "Lucy", "age": 19},
{"name": "Mark", "age": 19},
{"name": "Charlie", "age": 17},
{"name": "Aaron", "age": 18},
{"name": "Tess", "age": 16},
{"name": "Isaac", "age": 16}
]/>
<#assign orderingCriteria = {"name": "original_order_by_age", "colName": "age", "order":"o"} />
<@hardisAdv.groupList .data_model.seqData orderingCriteria; aPerson>
<@hardisAdv.groupHeader "original_order_by_age"; infoGroupOriginalOrderByAge>
Group of ${ infoGroupOriginalOrderByAge .label}: ${ hardisAdv.summary("age", "count", infoGroupOriginalOrderByAge) } people
</@hardisAdv.groupHeader>
${ aPerson.name} has ${ aPerson.age }
</@hardisAdv.groupList>

↑ Top of page


  • Aucune étiquette