Counter |
The Counter class assists in the creation of a simple kind of report that
comes up frequently in data-heavy projects: group by a field and display
the number of records that have a given value for that field. For example,
if you had a database containing many people and their preferred shirt
sizes, you could supply this class with the shirt_size_id field object,
the full collection of Fields from your component and a Listing that would
normally fetch all the people and their shirt sizes. Combining the data
from the fetchData() method in this class with the Fields from its
buildRenderFields() method, you could use those objects to easily render
a table showing how many users requested a Small shirt, a Medium shirt,
etc. |