groupBy
Topic group Related topics Example
The name of the field upon which groups are formed.
Property of
Group
Description
dBASE Plus groups rows by monitoring the value of a field in the rowset. The groupBy property contains the name of a field as a character string with an optional ascending or descending sort designation (not case-sensitive, ascending is the default). You may abbreviate ascending as "ASC" and descending as "DESC". For example, if you’re grouping by the Age field, you could have one of the following strings as the groupBy property:
Age
Age asc
Age desc
Age ascending
Age descending
The ascending and descending options have an effect only if the report’s autoSort property is set to true. In that case, dBASE Plus will make sure that the data in the rowset is sorted by the correct field in the correct direction.
No matter what the value of autoSort is, the named field must exist in the rowset. dBASE Plus looks for that field in the rowset’s fields array, just as you would. For example,
rowset.fields[ "Age" ].value
Because dBASE Plus uses the rowset’s fields array, you can group on calculated fields. There are two ways to do this. You can create a calculated field in an SQL SELECT statement, in which case set autoSort to true; or you can create the calculated field by adding a Field object to the rowset’s fields array, in which case you must set autoSort to false, because the named field doesn’t exist in the table, so you can’t sort on it. You would still have to make sure that the rows are sorted in the correct order so that all the rows in the same group are contiguous in the rowset.