FieldsSupportAggregations()

Summary

Returns a list of fields that support aggregation rules.

Syntax

aggr = FieldsSupportAggregations(string view, array fields, array options)

Argument Contents
view The name of the view
fields A list of fields to be considered

No options are currently supported.

Returns

An array of fields that allow their aggregation modes to be set.

Notes

  • The array of fields can be null, if all fields are to be considered.

  • If the input fields array is not null, the return array is a sub-array of the input, i.e., it uses the same order and field specification as the input.

Example

// Change the aggregation settings for the Population field.
table = GetTableStructure("State") // Get all the settings of the table
aggr = FieldsSupportAggregations("State", {"White", "Black", "Population"}, )
if ArrayPosition(aggr, {"Population"}, ) <> 0 then do
// We can set aggregation rules for "Population"
for i = 1 to table.length do
if table[i][1] = "Population" then
// Set the new aggregation rules:
table[i][7] = {{"Sum"},{"Count"}, {"Max"}}
// For ModifyTable: add the original field name
table[i] = table[i] + {table[i][1]}
end
ModifyTable("State", table)
end
else
ShowMessage("Cannot set aggregation rules for the Population field.")

Error Codes

Error Type Meaning
NotFound The specified view or field was not found
Error Invalid field specification

See Also

Function Summary
GetFieldAggregations() Gets the aggregation rules for a field
GetTableStructure() Gets a list and description of the fields in a table
JoinViews() Creates a joined view by linking fields in two existing views
JoinViewsMulti() Creates a joined view by linking multiple fields in two existing views
ModifyTable() Modifies the file structure of a dBASE, fixed-format text, or fixed format binary table