Cycle SCAN-ENDSCAN construction in report

Cycle SCAN-ENDSCAN construction in report

 

All records of a data table, attached to the Table of project data collection, may be inserted in a document as a table rows or in any free form. For this use keywords \SCAN(DataTable)\ and \ENDSCAN\. Inside cycle scan-endscan may be located a block of text with data fields, variables and constants, for example:

Lines with words "SCAN", "ENDSCAN" are excluded from the result document. However, if in step of designing a report you want to see as will look a result, you may set an attribute "hidden font" for words "SCAN", "ENDSCAN".

Full format of scan block is:

\SCAN(DataTable) [, WHILE(<boolean value>)] [,page] [,noeof] [,function1,...,functionN]\

.............................................

\Scanentry [,function1,...,functionN]\

.............................................

\Scanfooter [,function1,...,functionN]\

.............................................

\ENDSCAN [,function1,...,functionN]\

 If keyword "WHILE" defined in a scan expression, scan block will be terminated when <boolean value> returns false result. "WHILE" is often used with records grouped by some data field. <boolean value> may be a report variable, data field or user defined function.

Option "page" forces to begin every record of scanned DataTable (besides first) from a new page.

If you use option "noeof" report generator will skip entire scan block if scanned DataTable have no any records. This option is useful when making master-details reports.

Attention: with option "noeof" scan block will start from the current record. DataTable will not be moved to the first record.

Words "Scanentry" and "Scanfooter" are optional. You may add them when using option "noeof" in "scan" keyword, or if you want to develop some special functionality, calling optional scan block functions.

Use option "noeof" with keyword \Scanentry\ to manage scan block with some header section. Every new record of DataTable will return control to the position of \Scanentry\ keyword. However, if DataTable has no any records, entire block from "scan" to the "endscan" will be missed. For example:

Keyword \Scanfooter\ may be used to manage scan block with some footer section. Every time when report generator gets "Scanfooter", it returns control to the position of \Scanentry\ or \Scan\ keyword. If DataTable has no any records, entire block from "Scan" to the "Endscan" will be missed. For example:

\Scanentry\ and \Scanfooter\ may be used simultaneously:

NOTE: You must type keywords \scan(...)\, \scanentry\ and \endscan\ all with the same format attributes, for example with font Arial, 10, regular (or other that you like). It guarantees that format attributes inside block scan-endscan will be correct in output document.

If you use "page" option and a table immediately after "scan" keyword in report template, keep in mind that you should have at least one paragraph (empty line) before the table in the RTF document, otherwise, RTF editor such as MS Word ignores "new page" control.

Recommended technique:

When editing report template, place keywords \scan(...)\, \endscan\ outside of table or in the same cell to prevent corrupting of RTF table structure.