The TEssHtmlReport component descends from TDSTableProducer. See Delphi online help for properties and methods not covered here.

Html Template rules  
 
Built in Functions for use in HTML pages report_title
report_date
  insert_table
  use_these_fields
  as
  function
  field
  grouped_fields
  grouped_fields_color
  summary_fields
  SQL
 
Using group and summary functions


 


Rules for creating a report using an HTML template:

1) The class looks for certain key words or functions (list below) in the text of the HTML document you provide (see example HTML documents included). When it finds that function it replaces the function text you wrote with the appropriate value.

2) Any function in the HTML must start and end with the percent (i.e. %) symbol.

 

 

Built in functions you can add to any HTML document
(see examples included in the ZIP file):

Note: The bracketing symbols "<" and ">" indicate places where you need to insert your text. They should not appear in your final HTML document text. For example: %function=<equation>%, means your function will look like %function=Sum(field1)%, and should NOT look like %function=<Sum(field1)>%

%report_title% = inserts the default report's title where you want it.

%report_date% = inserts the date the report was created.

%insert_table% = inserts the table of output at this spot. This will insert ALL the fields from the assigned query. To limit the fields output, use the %use_these_fields% function or assign columns in the component itself.

%use_these_fields% = Used to select specific fields for the table output. How it works: Create a table in the HTML document with the field names you want output, their format (bold, italic, font size etc), the field colors, etc. You may give new names to the output fields using the %as% function. Place the %use_these_fields% function just before this table to indicate to the interpreter that is the field list to use. The report will only use those fields in the output that occur in the defined fields table (see attached example "example report.htm").

%as% = used to define new field names. Used only in the %use_these_fields% function. Example: TOTAL%as%Sum = the output for field TOTAL will appear as Sum in the report. TOTAL%as%SUM must all be on one line without breaks or spaces. The table might appear very wide in your HTML editor, but it will be set to the right width in the report.

%function=<equation>% = For user defined math and summation function. Support for addition (+), subtraction (-), multiplication (*), division (/), exponent (^), COUNT(<field name>), SUM(<field name>), AVG(<field name>), MAX(<field name>), and MIN(<field name>). Example: %function=sum(adult_males)/sum(adult_females)%.

%field=<database field name>% = For single record report outputs (such as singleton selections of totals and sums). See example report enclosed.

%grouped_fields=<field1;field2;etc.>% = For embedding desired grouped fields in the HTML document. Also can set in the component itself. If this function is in the HTML document, it will override what is set in the component.

%Grouped_fields_color=<color>% = Setting the group cells background color. Color must be either a text color word (e.g. black, white, yellow, etc.) or a color hex number (e.g. #CCFFFF)

%summary_fields=<field1,function;field2,function;etc.>% = For embedding desired summary fields into the HTML document. This can also be set in the component itself. If this function is in the HTML document, it will override what is set in the component.

%sql=<sql text>% = For embedding sql code into the html page. You can use this to pass the sql procedure and fields to the TEssHtmlReport component at runtime. Example: %sql=select place, time from atable where time>'12:00:00' order by place asc, time asc%.

 

Using Grouping and Summary Functions.

Summary field lists must be a field and function pair separated by a comma.

Example:

Field1,Sum

More than one summary field pair must be separated by a semicolon.

Example:

Field1,Sum;Field2,Count

Group fields must be separated by a semicolon. They have no function notation. The groups will output any summary fields defined. If no summary fields defined, then no grouped output will be created.