This macro is the counterpart of the groupHeader macro. By placing this macro in the groupList macro content, it is possible, when browsing the ordered sequence, to detect when the current element is the last element in a group, in order to execute the nested content of this macro.
This macro can be used to display information on the current group (a sub total for example) after displaying the content of the current element.
When browsing the ordered sequence, the nested content of this macro will only be executed once per group: when the current element is the last in the group.
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> ${ aPerson.name} has ${ aPerson.age } <@hardisAdv.groupFooter "original_order_by_age"> End of age group. </@hardisAdv.groupFooter> </@hardisAdv.groupList>
has the result:
Mary is 18
End of age group.
Lucy is 19
Mark is 19
End of age group.
Charlie is 17
End of age group.
Aaron is 18
End of age group.
Tess is 16
Isaac is 16
End of age group.
Information can be accessed from the current element group by passing a loop variable to the macro which will be supplied by it and can be used in its nested content. This variable is a Hash object which groups information on the group via the following attributes:
- label: group title,
- startRow: number of row in the ordered sequence of the first element of the group,
- endRow: number of row in the ordered sequence of the last element of the group,
- namedGroup: name of the named group if the current element group is a named group.
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> ${ aPerson.name} has ${ aPerson.age } <@hardisAdv.groupFooter "original_order_by_age"; infoGroupOriginalOrderByAge> End of group of ${ infoGroupOriginalOrderByAge .label}: ${ infoGroupOriginalOrderByAge .endRow - infoGroupOriginalOrderByAge .startRow } people </@hardisAdv.groupFooter> </@hardisAdv.groupList>
has the result:
Mary is 18
End of group of 18: 1 people
Lucy is 19
Mark is 19
End of group of 19: 2 people
Charlie is 17
End of group of 17: 1 people
Aaron is 18
End of group of 18: 1 people
Tess is 16
Isaac is 16
End of group of 16: 2 people
Empty directive: No
Parameters
String |
groupName |
Name of the group whose output is to be detected during browsing |
Mandatory |
For example
<@hardisAdv.groupList .data_model.seqItems orderingCriteria; aItem> <@hardisAdv.groupHeader "orderGroup1"; infoGroup> Beginning of group ${ infoGroup.label } </@hardisAdv.groupHeader> ... ${ aItem.fooAttribute} ... <@hardisAdv.groupFooter "orderGroup1"; infoGroup> End of group ${ infoGroup.label } </@hardisAdv.groupFooter> </@hardisAdv.groupList>