groupdataconnection
Properties
Name | Type | Required | Description |
---|---|---|---|
datadefinition | yes | Id of a data definition that will supply the source data that this data definition will group |
Sub-tags
Name | Type | Cardinality |
---|---|---|
parameter | 1..n |
Content
None
Anchor | ||||
---|---|---|---|---|
|
parameter
Properties
Name | Type | Required | Default | Description |
---|---|---|---|---|
type | 'string', 'int', 'date' or 'url' | no | 'string') | An indicator of how the data should be displayed on the client |
name | string | no | lowercase value of column | A unique identifier for the parameter |
label | string | no | 'pretty' value of column | A user displayable label for the column |
column | ref | no | 'pretty' value of column | A user displayable label for the column |
Sub-tags
None
Content
None
Notes
- The
column
attribute either references a parameter in the source data definition or it uses one of the following formulassum(parameter)
- The average value of theparameter
avg(parameter)
- The average value of theparameter
min(parameter)
- The average value of theparameter
max(parameter)
- The average value of theparameter
count()
- The count of the records in the grouprownum()
- The row number of the recorddate()
- The current date
- If no
label
is specified then it will be generated by formatting thename
, unless noname
is supplied, then it will be generated by formatting thecolumn
- Formatting involves converting any _'s to spaces, converting the first letter and any letter after a space to upper case and converting every other letter to lower case, e.g. "BOMB_DISPOSAL_METHOD" becomes "Bomb Disposal Method"
Examples
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>
|
representing this table
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>
|
will generate this
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>
|
will generate this
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>
|
will generate this
group | sum | avg | min | max | count |
---|---|---|---|---|---|
1-jan-2000 | 7 | 2.33 | 1 | 4 | 3 |
2-jan-2000 | 10 | 3.33 | 2 | 5 | 3 |
3-jan-2000 | 6 | 2 | 1 | 3 | 3 |
4-jan-2000 | 1 | 1 | 1 | 1 | 1 |