Display Totals and Counts in Grid Reports
Grid Control 2.0
Display Totals and Counts in Grid Reports
Technologies > User Interface Add-Ins > Parts for Reports > With Totals on Numeric Fields
You can display the total count of records in a grid panel. The total count includes all records that meet the current grid restriction, not only the records that are displayed on the current page.
You can also display totals for any numeric field. You can enable or disable the totals for each numeric field separately.
You can only display totals if the grid uses a non-grouping data source. To display totals for a grouping data source, use the cross-table panel. See Display values in a cross-table .
Show Totals and Show Counts
Use these two attributes,
showTotals
and
showCounts
, to display column totals and counts of records in grid reports:
-
To display totals for a numeric field, add the
showTotals="true"
attribute to the<field />
tag in the data source. If the field is defined in both the data source and the panel, add theshowTotals
attribute in both places. -
To display a count of records, add the
showCounts="true"
attribute to the grid panel.
For example:
<view version="2.0">
<title>Building Interior Areas</title>
<dataSource id="bl_ds1">
<table name="bl"/>
<field name="bl_id"/>
<field name="name"/>
<field name="area_gross_ext" showTotals="false" />
<field name="area_gross_int" showTotals="true" />
<field name="date_bl"/>
</dataSource>
<panel type="grid" id="bl_grid1" dataSource="bl_ds1" showCounts="true">
<title>Buildings</title>
</panel>
</view>
Example view: http://localhost:8080/archibus/schema/ab-products/solutions/parts/grid/ab-ex-report-grid-totals.axvw
Two or More Fields with the Same Name
If the panel’s
<dataSource>
element contains two or more fields with the same name from different tables, such as main and standard, you must customize your code. To support
showTotals
and
showCounts
for such a panel, modify the
<dataSource>
element to contain a custom SQL query, and use field aliases to rename duplicate fields.
The following view uses a custom SQL query and field aliases.
Example view: http://localhost:8080/archibus/schema/ab-products/solutions/parts/grid/ab-ex-report-grid-sql-union.axvw