Maptitude GISDK Help

AggregateTable()

Summary

Groups records in a view and computes summary statistics.

 

Syntax

rslt = AggregateTable(string new_view, string input_view_set, string output_type, string output_filename, string aggregation_field_name, array output_fields, array options)

 

Argument Contents
new_view The desired name for the result view
input_view_set The name of the input view and selection set
output_type The type of file to create ("CSV", "dBASE", "FFA" or "FFB") or "MEM" to save to a memory table
output_filename The name of the output file
aggregation_field_name The field on which records are grouped
output_fields An array containing one element for each field in the output table. Each element is an array of three items, that indicates the statistic calculated, as shown below

 

Item Type Contents
1 String Name of a field in the input view
2 String Statistic: "SUM", "MIN", "MAX", "DOM" (DOMINANT), "AVG" (AVERAGE), "STDDEV" or "COUNT"
3 (optional) String Name of a field in the input view used in computing averages. Necessary only for averages; must be a numeric field

 

Option Type Contents
Missing as zero N/A No contents necessary. This option causes all missing numeric values in the input view to be treated as zeros in sum, average, min or max calculations

 

Returns

A string containing the name of the view of the new table.

 

Notes

Statistic Prefix Example
Sum (none) Income
Min Low Low Income
Max High High Income
Average Avg Avg Income

Example

// Aggregate a table and write the results to a memory table

flds = {{"Population","sum", },
        {"Population","min", },
        {"Population","max", },
        {"HH Income","average", "Households"}}
rslt = AggregateTable("State Subtotals", "County Data|Selection", "MEM", , "State ID", flds, null)

 

Error Codes

Error Type Meaning
Error The output_fields array does not have the correct format; one or more of the following input variables is null or invalid: new_view, output_type, output_filename, aggregation_field, output_fields; or a file I/O error occurred (e.g., out of disk space).
NotFound The input view or set does not exist, or the input aggregation field or one of the data fields does not exist.

 

See Also

Function Summary
ApplyOverlayTable() Computes attribute values for a view using information from an overlay table
ColumnAggregate() Performs a geographic overlay between two layers and aggregates tabular data
ComputeIntersectionPercentages() Intersects two or more area or line layers and computes the intersection percentages
MergeByValue() Creates districts by merging areas from a geographic file, based on the value of a field
SelfAggregate() Groups the records in a view, based on a field, to create an aggregate view

 

 

©2025 Caliper Corporation www.caliper.com