Chapter 18: Logical Reports Up Chapter 18: Logical Reports Section 18.2: Saved Meta Data  

18.1 Invoking a logical report

The report ’function’ is unchanged - but the calling procedure is enhanced to include :
START REPORT report-name TO CONVERTABLE
as well as the familiar TO PIPE/TO FILE etc.
This creates the meta data file (in /tmp) which can be processed later.

18.1.1 ’Finishing’ the report

The processing is done via the FINISH REPORT statement, CONVERT REPORT statement or via an external program process_report.
The enhanced FINISH REPORT now accepts the following syntax :
FINISH REPORT report-name CONVERTING TO "filename" AS "type" [ USING "layout" ]
(You can also CONVERTING TO PRINTER, TO PIPE)
FINISH REPORT report-name CONVERTING TO EMAIL AS "type" [ USING "layout" ]
FINISH REPORT report-name CONVERTING TO MANY

18.1.2 Converting to "filename"

"type" can be any one of the conversions available on the system.
These are in $AUBITDIR/lib called libLOGREPPROC_*.[so/dll]
On an average system you may have :
This means you can process types of "CSV", "TXT" or "PDF" A special name of "SAVE" can also be used which copied the data verbatim from the meta data file into the filename specified. This file can then be used with the layout editor and/or the process_report program.
If USING "layout" is omitted a default layout will be used.

18.1.3 Default layouts

For PDF and TXT it is safe to setup a default layout.
These can be put in the $AUBITDIR/etc directory and have a .lrf extension. The filename is made up of combinations of program/module/report name and the width of the page (<=80 = narrow <=132 = normal >132 = wide). The search order is complex - but basically it depends on :
  1. program_module_report_type.lrf
  2. program_report_type.lrf
  3. program_module_type.lrf
  4. module_report_type.lrf
  5. report_type.lrf
  6. module_type.lrf
  7. program_type.lrf
If none of these is found - then it looks for :
  1. default_type_narrow.lrf
  2. default_type_normal.lrf
  3. default_type_wide.lrf
dependingon the width
Finally - it will use
  1. default_type.lrf
(Where type is PDF, TXT or CSV for example)
To create one of these defaults - use layout_engine (for PDF and TXT, you can edit using any meta data file as an input)

18.1.4 Converting to many

This allows multiple conversions. The meta data file is not automatically deleted so it is possible to use the same meta data to generate a text file, CSV output and PDF if required.
To do this you need to use the CONVERT statement
CONVERT REPORT rep-name TO "filename" AS "type" USING "layout" 
again - USING "layout" is omitted, one will be generated automatically..
Once you’ve done all your conversions, free report will delete the meta data.
Examples :
START REPORT r1 TO CONVERTIBLE
OUTPUT TO REPOTY r1 (1,2)
FINISH REPORT r1 CONVERTING TO "myfile1.pdf" 
   AS "PDF" USING "layout1" 
START REPORT r1 TO CONVERTIBLE
OUTPUT TO REPORT r1 (1,2)
FINISH REPORT r1 CONVERTING TO "myfile2.pdf" AS "PDF" # uses default layout 
START REPORT r1 TO CONVERTIBLE
OUTPUT TO REPORT r1 (1,2)
FINISH REPORT r1 CONVERTING TO MANY
CONVERT REPORT r1 TO "orig.output" AS "SAVE"
CONVERT REPORT r1 TO "myfile3.pdf" AS "PDF"
CONVERT REPORT r1 TO "myfile4.txt" AS "TXT"
FREE REPORT r1 
 Chapter 18: Logical Reports Up Chapter 18: Logical Reports Section 18.2: Saved Meta Data