...
Given the following data definition describing a table that contains a unique 'id' for each row, a non-unique 'group' for each row, a 'value' and a 'date' when that value was recorded.
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
<data:datadefinition id="test.source"> <datasourcedataconnection datasource="test.datasource" table="TESTDATA" key="ID"> <parameter name="group" label="Group" column="GROUP"/> <parameter name="date" label="Date column="DATE" type="date"/> <parameter name="value" label="Value" column="VALUE" type="integer" /> </datasourcedataconnection> </data:datadefinition> |
...
ID | GROUP | DATE | VALUE |
---|---|---|---|
0 | A | 1-jan-2000 | 1 |
1 | A | 2-jan-2000 | 3 |
2 | A | 3-jan-2000 | 1 |
3 | B | 1-jan-2000 | 2 |
4 | B | 2-jan-2000 | 5 |
5 | B | 3-jan-2000 | 3 |
6 | C | 1-jan-2000 | 4 |
7 | C | 2-jan-2000 | 2 |
8 | C | 3-jan-2000 | 2 |
9 | C | 4-jan-2000 | 1 |
This example
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
<!-- Create a new data definition that groups all of the values --> <data:datadefinition id="test.group"> <groupdataconnection datadefinition="test.source"> <parameter name="sum" label="Sum" column="sum(value)"/> <parameter name="avg" label="Average" column="avg(value)"/> <parameter name="min" label="Minimum" column="min(value)"/> <parameter name="max" label="Maximum" column="max(value)"/> <parameter name="count" label="Count" column="count(1)"/> </groupdataconnection> </data:datadefinition> |
...
sum | avg | min | max | count |
---|---|---|---|---|
24 | 2.4 | 1 | 5 | 10 |
This example
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
<!-- Create a new data definition that groups the values based on their 'group' value --> <data:datadefinition id="test.group"> <groupdataconnection datadefinition="test.source"> <parameter name="group" label="Group" column="group"/> <parameter name="sum" label="Sum" column="sum(value)"/> <parameter name="avg" label="Average" column="avg(value)"/> <parameter name="min" label="Minimum" column="min(value)"/> <parameter name="max" label="Maximum" column="max(value)"/> <parameter name="count" label="Count" column="count(1)"/> <group column="group"/> </groupdataconnection> </data:datadefinition> |
...
group | sum | avg | min | max | count |
---|---|---|---|---|---|
A | 5 | 1.66 | 1 | 3 | 3 |
B | 10 | 3.33 | 2 | 5 | 3 |
C | 9 | 2.25 | 1 | 4 | 4 |
This example
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
<!-- Create a new data definition that groups the values based on their 'date' value --> <data:datadefinition id="test.group"> <groupdataconnection datadefinition="test.source"> <parameter name="group" label="Group" column="date"/> <parameter name="sum" label="Sum" column="sum(value)"/> <parameter name="avg" label="Average" column="avg(value)"/> <parameter name="min" label="Minimum" column="min(value)"/> <parameter name="max" label="Maximum" column="max(value)"/> <parameter name="count" label="Count" column="count(1)"/> <group column="date"/> </groupdataconnection> </data:datadefinition> |
...