Summarize a calculated value by a group criteria
Summarize a calculated value by a group criteria
Technologies > User Interface Add-Ins > Grouping Views > Grouping DataSource
Groups rooms by room standard and return total room area for each standard:
<dataSource
type="grouping"
>
<table name="rm"/>
<field name="rm_std"
groupBy="true"
/>
<field name="total_area"
formula="sum" baseField="rm.area"
dataType="number" size="6" decimals="0"/>
</dataSource>
Calculated fields, as in the example above, can use a formula. Supported formulas are:
sum
,
count
,
avg
,
min
, and
max
- in other words SQL-99 aggregate functions. These fields must include a
baseField
attribute that refer to the field that will be calculated using a formula.
Note that sort fields can refer to either grouping or calculated fields by their names:
<sortField name="total_area" ascending="false"/>
If a calculated field is based not on a physical database column, but on a virtual column defined in your custom SQL query, you need to specify the numericFormat property for the calculated field as numericFormat="default":
<field name="sum_mass" dataType="number" formula="sum" baseField="waste_out.massQuantity" decimals="4">
Percent-based calculated fields
Calculated fields defined in grouping data sources can use
sum-percent
and
count-percent
formulas. Previously, these fields had to use SQL expressions:
<field name="percent_area" dataType="number" size="6" decimals="0" baseField="rm.area" formula="sum-percent">
<title>Percentage Area</title>
</field>
File : ab-products/solutions/parts/cross-table/ab-ex-crosstable-percent.axvw
For a non-grouping data source, Grid Control 2.0
View:
http://localhost:8080/archibus/schema/ab-products/solutions/parts/chart/ab-ex-grouping-ds.axvw
View:
http://localhost:8080/archibus/schema/ab-products/solutions/parts/cross-table/ab-ex-crosstable-percent.axvw