[reportlab-users] Report Format

Rich Shepard rshepard at appl-ecosys.com
Thu Jun 21 19:44:39 EDT 2007


I've been struggling with the issue of how to format one report, and I'd
like to gain from the collective wisdom and experience of folks here.

The application is a mathematical model, with input values and outputs
stored in database tables (embedded SQLite-3 using pysqlite). The first
report I need to code is a list of all model input variables and their
values.

I see this as a banded report, with the model description as a header.
That's because there's a hierarchy of variable types, and my prior experience
used banded reports for this type of situation. But, ReportLab doesn't do
banded reports. This means I need to use either paragraphs or tables as
components for the story. I've wasted weeks trying to decide which.

I've retrieved records from tables, and stored them in lists. Should I use
each variable/value pair as a separate paragraph? Should I create a header
from the model table's variables/values pairs, and then create a table where
the hierarchy is represented by the column in which the flowable value is
placed (the variable names would be the column headers).

Is there a better way of doing this?

This is what I've written so far:

def PrintInputs():
# Our container for 'Flowable' objects
elements = []

# A large collection of style sheets pre-made for us
# styles = getSampleStyleSheet()

# The name of the output file.
docName = self.appData.projname
doc = SimpleDocTemplate(docName + '.pdf')

elements.append(Paragraph("FuzzyEI-Assessor Input Values Report", styles['Title']))

# General Model Information
self.cur.execute("select * from model")
self.data = []
self.data = self.cur.fetchall()

elements.append(Paragraph("Model name: ", self.data(model_name)))
elements.append(Paragraph("Model description: ", self.data(model_desc)))
elements.append(Paragraph("Model type: ", self.data(model_type)))
elements.append(Paragraph("Knowledge engineers: ", self.data(kename)))

# Components/Policies
self.cur.execute("select * from policy")
self.data = []
self.data = self.cur.fetchall()

...

Rich

--
Richard B. Shepard, Ph.D. | The Environmental Permitting
Applied Ecosystem Services, Inc. | Accelerator(TM)
<http://www.appl-ecosys.com> Voice: 503-667-4517 Fax: 503-667-8863


More information about the reportlab-users mailing list