PRECOPY, PREDEVICE, PREJOB, PREPAGE, POSTCOPY,... |
Top Previous Next |
Syntax
precopy | postcopy | prejob | predevice | postjob | prepage | postpage | postdevice { code block }
Note: the opening brace "{" needs to be on the same line as the keyword. The closing brace may follow the last statement, or be on the line below the last statement.
Description
These keywords are used to add Business Basic processing code to the form or report. They represent six different subroutines that UnForm executes at specific points during processing. The code block can be an arbitrary number of Business Basic statements; the total number of statements in all code blocks can be about 6,000.
Any valid Business Basic programming code can be entered, including I/O logic, loops, variable assignments, and more. Program to your heart's content. UnForm will add extensive error handling code within your code, and report syntax errors to the error log file or a trailer page.
Note that the merge command, while not executable code, is honored within a code block. The merged data must be valid code block syntax.
For more details about programming code blocks, see the Programming Code Blocks chapter.
Example:
This example shows how to use various routines to make copy 2 of a form be a conditionally faxed invoice, using a CSV formatted file containing a customer ID and a fax number.
prejob { exportfile$="/exports/faxnums.csv" today$=dte(0:"YYYY-MM-DD") faxlog$="/exports/logs/fax"+today$+.log" }
prepage { invoice$=get(65,5,7) custid$=get(65,4,6) custname$=trim(get(10,10,35)) faxnum$=getfilefield(exportfile$, custid$, 2) }
precopy { if copy=2 then: if faxnum$>"" then: output$="|fx -n "+faxnum$ log(invoice$+" "+custid$+" "+custname$, faxlog$) end if end if }
Drivers: all, but predevice and postdevice are only supported by pcl, ps, and pdf drivers. |