Kryvich’s Delphi Reporter

Open-source reporting tool for Embarcadero's (CodeGear, Borland) Delphi IDE

Downloads

This is a last public version of the Kryvich's Delphi Reporter:

Kryvich's Delphi Reporter 2.0 (January 7, 2012)

[+] Support for Delphi XE2.

Includes source code and demo project with RTF & HTML templates.

History

Kryvich's Delphi Reporter 1.0.2 (January 24, 2009)

[+] Support for the aggregate fields.

Kryvich's Delphi Reporter 1.0.1 (June 11, 2008)

[+] Support for the memo fields (TMemoField, TWideMemoField).

Kryvich's Delphi Reporter 1.0 (August 14, 2007)

Templates

The reporter creates reports based on templates.

The template is a common RTF or HTML file that consists tags.

The tag is a command for the reporter. For a RTF template the tags have to be enclosed in curly brackets “{}”. For a HTML template the tags have to be parenthesized with “\{” and “\}”.

Tags recognized by Reporter

It’s a list of tags of a template that can be recognized and evaluated by Kryvich’s Delphi Reporter:

Tag Description
 {Table.Field} Placeholder for a value of the field of specified table (datasource). Reporter uses DisplayText property of TField when retrieving its representation.
Iterations
 {for Table} Begin of a cycle over records of specified table.
 {for Table.Field} Begin of a cycle over records of specified table. This cycle iterates over record ranges with the same value of the given Field.
 {end} End of the last opened cycle. Reporter will iterate records until end of table or any parent cycle will indicate an end of the record range.
Build-in functions
 {Version} Placeholder for the version of the reporter
 {Date} Placeholder for the current date. Equal to the Delphi code: DateToStr(Date);
 {Time} Placeholder for the current time. Equal to the Delphi code: TimeToStr(Time);
 {Now} Placeholder for the current date/time. Equal to the Delphi code: DateTimeToStr(Now);
Aggregates
 {Sum(Table.Field)} Totals the values for a numeric field
 {Avg(Table.Field)} Computes the average value for a numeric or date-time field
 {Count(Table.Field)}

or {Count(Table.*)}
Specifies the number of non-blank values for a field or the number of records in a table
 {Min(Table.Field)} Indicates the minimum value for a string, numeric, or date-time field
 {Max(Table.Field)} Indicates the maximum value for a string, numeric, or date-time field

Any other tag in a template that can’t be evaluated by Reporter itself has to be populated in the OnGetCustomTagValue event handler.

Demo Project

There is a demo project included in the distribution kit which shows work of the reporter. To demonstrate various techniques as data sources I’ve used several TDataSet descendants:

  • TTable, connected to the Paradox database file (.db) using BDE.
  • Several TTable objects linked with detail-master relationships.
  • TQuery.
  • TADOQuery, linked to the MS Access database file (.mdb).

Source text of this demo-project also is included.

Demo reports are created on the basis of DBDEMOS database, which distributed with Delphi. Here the list (in the order of a complexity increase):

  • Simple Customer List Report.
  • Invoice Report.
  • Order History Report.
  • Part Sales Report.

Questions & Answers

Please ask. My e-mail can be founded in File_Id.diz included in distribution kit.

Plans

Plan for the future versions of Kryvich’s Delphi Report includes but not limits to these features:

  • Simple arithmetic operations in tags. For ex. {Items.Qty*Parts.ListPrice*(100-Items.Discount)/100}.
  • Named tags: Tags with names assigned that can be used in other tags, just like database fields. For ex. Named tag {AnnualSales=Sum(PartSales.Amount)}, which further can be used in tag {Max(AnnualSales)} (see following feature – aggregates for custom tags).
  • Add aggregates for custom tags, populated via OnGetCustomTagValue. For ex. we will can write {Sum(PartTotal)}, see “Invoice Report Demo”.
  • …Any suggestions?

Contact us / Feedback

Further questions, suggestions, comments, feature requests, error reports, source fragments and modifications are very welcomed! You can find my e-mail in File_Id.diz included in distribution kit.

Newest version: 2.0
January 7, 2012

Main features:

  • Uses RTF or HTML templates
  • Creates reports in RTF or HTML format
  • Direct access to RTF files (MS Word not required)
  • Gets data from any TDataSet descendant (the cycles used to pass datasets)
  • Nested cycles (datasets) supported
  • Supports Delphi 7, Delphi 2005, Delphi 2006, Turbo Delphi (Explorer & Professional), Delphi 2007




































































See also:
Kryvich’s Delphi Localizer