Creating Reports with Query Objects

By: J. Brant, J. Yoder
Published in: PLoPD4
Pages: 375-390
Category: Database

Summary: Dynamic creation of formulas and queries for database-reporting applications. A Smalltalk perspective, but still generally applicable.


Pattern: Report Objects

Pages: 376-378

You need to create a configurable reporting application. Information will be given in a formula based on a database query. Define objects that represent the report that are made up of objects that process and view the data. A report is created by attaching processing objects to viewing objects. Use Query Objects to select data from the database and Formula Objects to operate on the data.

Pattern: Query Objects

Pages: 378-381

You're using Report Objects and need to create queries for reports at run-time. Create objects that represent queries. Define operations on these objects and a method to return query results.

Pattern: Composable Query Objects

Pages: 381-384

You're using Query Objects to build dynamic queries. Many reports have similar queries. Build queries out of composable parts. Define one class to represent tables in the database. Define a class that performs each query.

Pattern: Formula Objects

Pages: 384-386

You're using Report Objects where some values are computed. You want the user to create or modify formulas at run-time. Define an object to represent the results of a computed formula. Use Constraint Observer so the result object is consistent with its inputs.

Category: Business Computation, Database

Pattern: Constraint Observer

Pages: 387-389

You're using Formula Objects and need to update results when input values change. Create a constraint object responsible for the computation. Use Observer [Gamma+95] to update the constraint when input values change. When the constraint is updated, it evaluates the formula and assigns the result.