Agg property editor

This is a feature of JBuilder Professional and Enterprise.

To display this dialog, select the agg property in the Inspector when a Column of a DataSet component is selected in the structure pane.

Use the Agg property editor to specify data aggregation properties from within the JBuilder UI Designer. Calculated aggregated columns can be used to group and/or summarize data, for example, to summarize total sales by quarter. Aggregation calculations can be specified completely through property settings and any number of columns can be included in the grouping. Four types of aggregation are supported (sum, count, min, and max) as well as a mechanism for creating custom aggregation methods.

The aggregate can be computed for the entire data set, or you can group by one or more columns in the data set and compute an aggregate value for each group. The calculated aggregated column is defined in the data set being summarized, so every row in a group will have the same value in the calculated column (the aggregated value for that group). The column is hidden by default. You can choose to show the column or show its value in another control. For more information, see Aggregating data with calculated fields in Database Application Developer's Guide. The aggDescriptor property is used to specify columns to group, the column to aggregate, and the aggregation operation to perform. Properties specified in this dialog are stored in an instance of an AggDescriptor object.

Available Columns

The list of columns in the DataSet from which you can select when choosing columns for grouping the data. Column names displayed in Grouping Columns are excluded from this list.

Highlight a column name then select Add To Group to add a column to the grouping. When you do this, the column name disappears from this list and is added to the Grouping Columns list.

Add To Group

Removes the currently selected column name from the Available Columns list and adds it to the Grouping Columns list.

Grouping Columns

The columns of the DataSet by which the aggregation should be grouped. Only non-calculated, non-aggregate column names are allowed in this list.

Remove From Group

Removes the currently selected column name from the Grouping Columns list and displays it in the Available Columns list.

Custom Aggregate/Calculation On Aggregate

Select this if you want to perform a custom aggregation, for example, a calculation on the aggregated values could involve the sum of line items multiplied by a constant "markup" amount. Selecting this field assigns a null value to the Aggregate Column and Aggregate Operation fields (which indicates a calculated aggregate operation), and disables both fields.

To specify a custom aggregate, select this option and

  1. Set the column type of the aggregate column to CalcType.AGGREGATE
  2. Register a CalcAggFieldsListener with the aggregate column's DataSet

Aggregate Column

Select the column from the DataSet whose values are going to be summarized in the aggregation operation. This column should be added to the data set prior to setting properties in the agg property editor. When the column is created, be sure to set its calcType property to aggregated, and its visible property to Yes.

Warning: if you set this column to a column that currently contains data, the data will be overwritten with the aggregated data.

Aggregate Operation

Select the class that provides the functionality for the aggregation operation you are performing. This list displays all AggOperators as well as user-defined ones within the same class context as the Aggregate Column value. Pre-defined aggregating operators include CountAggOperator (for counting the number of occurrences in the group), MaxAggOperator (for finding the maximum value in the group), MinAggOperator (for finding the minimum value in the group), SumAggOperator (for summing all the values in the group).