Maptitude GISDK Help |
Groups the records in a view, based on a field, to create an aggregate view.
new_view_name = SelfAggregate(string aggregate_view_name, string aggregate_field_spec, array options)
Argument |
Contents |
aggregate_view_name |
A proposed name for the new aggregate view |
aggregate_field_spec |
A full field spec that indicates the view whose records are aggregated, and the grouping field |
Option |
Type |
Contents |
Fields |
Array |
A list of aggregation specifications for the fields, overriding the default aggregation rules. Each aggregation specification is a two-element array containing a field name (string), and an aggregations array. The aggregations array is a list of rules of the same format as arrays returned by GetFieldsAggregations(). It can contain one or more of the arrays {"First"} or {"Dom"}, {"Sum"}, {"Min"}, {"Max"}, {"Avg"}, {"Avg", weight_field}, or {"StdDev"}. This will override the default aggregation rules for the fields specified in this option. |
Selection |
String |
The name of the selection set from which to aggregate. |
Additional Groups |
Array |
Strings with the field specs of the fields upon which to create further subgroups. |
A string indicating the actual name of the aggregate view.
If the input aggregate_view_name is used by some other view, a slightly modified version is used as the new view's name. The input aggregate_view_name cannot be null.
The grouping field can be numeric or string-typed. If it is string-typed, the aggregation is case-sensitive.
The aggregate view contains one record for each unique value of the grouping field (including the missing value). All the original records with the same value for the grouping field are grouped together. There is also one Count() field that indicates how many records there are in that group.
There can be up to six fields in the aggregate view for each numeric input view field, one for each of the First(), Sum(), High(), Low(), Avg(), and StdDev() aggregation methods. There can also be one field for each string-typed input view field for the First() aggregation method, which chooses the first record's value as a representative value. By default, the aggregation rules for each field are used; see GetFieldAggregations().
If the Fields option is used and a field is listed in the array and has no rules, the field will be suppressed. If a field is not listed, the Sum(), High(), Low(), Avg(), and StdDev() methods will be used.
An aggregate view is never mappable, even if the original view is.
It is not possible to edit values or add or delete records directly in the aggregate view. However, if the original view can be edited or it supports the addition or deletion of records, all changes are automatically reflected in the aggregate view.
Because an aggregate view reflects any changes made to the underlying view, data access may be very inefficient, especially when a group contains many records. One alternative is to use AggregateTable(). It reads all the data in the original view in a single pass, and writes out the results of the aggregation. OpenTable() then opens the results as a view. The aggregation, however, will not reflect subsequent changes to the original data.
// Aggregate county data to the state level
nv = SelfAggregate("States", "Counties.[State Code]", null)
Error Type |
Meaning |
Error |
The input aggregate_view_name is null or the aggregate_field_spec is ambiguous |
NotFound |
The input view or field does not exist |
Function |
Summary |
Groups records in a view and computes summary statistics |
©2025 Caliper Corporation | www.caliper.com |