Smartsite SXML CopyCode image Copy Code
<se:xmldatatable resulttype="datatable" save="xxx">
    <se:row>
        <se:col name="Browser">IE</se:col>
        <se:col name="Day">1</se:col>
        <se:col name="Week">1</se:col>
        <se:col name="Count">6</se:col>
    </se:row>
    <se:row><se:col>IE</se:col><se:col>2</se:col><se:col>1</se:col><se:col>3</se:col></se:row>
    <se:row><se:col>IE</se:col><se:col>3</se:col><se:col>1</se:col><se:col>8</se:col></se:row>
    <se:row><se:col>Firefox</se:col><se:col>1</se:col><se:col>1</se:col><se:col>2</se:col></se:row>
    <se:row><se:col>Firefox</se:col><se:col>2</se:col><se:col>1</se:col><se:col>5</se:col></se:row>
    <se:row><se:col>Firefox</se:col><se:col>13</se:col><se:col>2</se:col><se:col>7</se:col></se:row>
    <se:row><se:col>Opera</se:col><se:col>2</se:col><se:col>1</se:col><se:col>3</se:col></se:row>
    <se:row><se:col>Opera</se:col><se:col>12</se:col><se:col>2</se:col><se:col>3</se:col></se:row>
    <se:row><se:col>Chrome</se:col><se:col>9</se:col><se:col>2</se:col><se:col>5</se:col></se:row>
</se:xmldatatable>

=== Group on no column
{debug.write(datatable.aggregate($xxx, Count, true))}

=== Group on one column
{debug.write(datatable.aggregate($xxx, Count, true, Browser))}

=== Group on one column
{debug.write(datatable.aggregate($xxx, Count, true, Week))}

=== Group on two columns
{debug.write(datatable.aggregate($xxx, Count, true, Browser, Week))}
Example Result CopyCode image Copy Code
=== Group on no column
Count=9; Sum=42; Avg=4.66666666666667; Min=2; Max=8

=== Group on one column
Browser=IE; Count=3; Sum=17; Avg=5.66666666666667; Min=3; Max=8
Browser=Firefox; Count=3; Sum=14; Avg=4.66666666666667; Min=2; Max=7
Browser=Opera; Count=2; Sum=6; Avg=3; Min=3; Max=3
Browser=Chrome; Count=1; Sum=5; Avg=5; Min=5; Max=5

=== Group on one column
Week=1; Count=6; Sum=27; Avg=4.5; Min=2; Max=8
Week=2; Count=3; Sum=15; Avg=5; Min=3; Max=7

=== Group on two columns
Browser=IE; Week=1; Count=3; Sum=17; Avg=5.66666666666667; Min=3; Max=8
Browser=Firefox; Week=1; Count=2; Sum=7; Avg=3.5; Min=2; Max=5
Browser=Firefox; Week=2; Count=1; Sum=7; Avg=7; Min=7; Max=7
Browser=Opera; Week=1; Count=1; Sum=3; Avg=3; Min=3; Max=3
Browser=Opera; Week=2; Count=1; Sum=3; Avg=3; Min=3; Max=3
Browser=Chrome; Week=2; Count=1; Sum=5; Avg=5; Min=5; Max=5
SXML