| Search Locate Previous Next | Contents |
This topic applies to all NewLeaf documents, tabular or otherwise. The final output of NewLeaf is a series of ASCII page descriptions held in text vector format. While you continue to add text, tables, etc., to a document, NewLeaf saves each page to an APL component file as it is completed. This file is created by default in the TEMP directory (typically c:\temp or c:\windows\temp) and has the name newleaf.spl.
Over-riding the spool path
To choose your own path for the spool file, assign global leaf.spoolpath to the directory where the spool files are to be stored:
leaf.spoolpath'E:\reports'
This may be necessary if you only have write access to a particular set of network directories.
Over-riding the spool file name
If you have several copies of APL running NewLeaf at the same time on the same computer (possibly in a server environment) you will need to ensure that each instance uses a different file name for spooling. The application may set the spool file name, which is stored as a global leaf.spoolname:
leaf.spoolname'spool23.spl' leaf.spoolname'' © name will be generated
If you set this to null (as in the lower example) NewLeaf will make a file name of the form ~1234567.spl from the system clock at the time you call leaf.Use. This will give every spool file a unique name, but you will need to track and later delete these yourself.
The file tie number is the value of leaf.spool; so if you must untie all component files while producing a report, do so using FUNTIE FNUMS~leaf.spool. To this point, you have used leaf.Close to terminate each report. This has the effect of reading the component file and concatenating all of the page descriptions into a single text vector which is returned as the result. The component file is erased, so:
leaf.Init ª leaf.Use'' leaf.table.Titles districts leaf.table.List sales[1;;] leaf.NewPage leaf.table.List sales[2;;] View docleaf.Close
leaves the entire document description in the variable doc. It is frequently useful to leave the document on file. This is done by terminating it with leaf.Spool which unties the file and returns its name. This allows you to rename the file and keep it for later viewing:
leaf.Init ª leaf.Use'' leaf.table.Titles districts leaf.table.List sales[1;;] leaf.NewPage leaf.table.List sales[2;;] docfileleaf.Spool 'C:\SALESREPS\96H1.rep' View 'C:\SALESREPS\96H1.rep'
If you run leaf.Spool with a null right argument, it returns the default file name (e.g. c:\temp\newleaf.spl) and simply unties the file.