|
Preface and Postscript Scripts
Use the Formula Editor to create and edit
"formulas" in your forms in order to perform special calculations.
Formulas may consist of simple calculations or complex sets of
programming statements. When these are combined together they are
called "scripts".
Preface Scripts
Preface scripts are executed at the very
beginning when a form is first executed. This is a useful place at
which to "initialise" variables and perform special operations
before form or reporting printing begins. Preface scripts are
optional. Any value you return from a Preface script is
ignored.
Postscript Scripts
Postscript scripts are executed after a user has
been prompted for form questions. Place script code that checks the
validity of user responses to your questions here. You may also use
a script to display warning messages about unacceptable responses
to your questions.
If there are no form questions, the form is
executed immediately after the preface script, unless you return a
FALSE value. In that case the form's execution is cancelled.
If you have defined questions and a postscript
script returns a FALSE value, the form questions list is
redisplayed and the user must correct the entries they have made.
It is recommended that you return a TRUE value if you find the user
responses to your questions acceptable. Postscript scripts are
optional.
End Report Scripts
If a file with the same name as your report, but
ending with the extension .MAC is found in the same folder as your
report, its contents is executed automatically by Visual
Builder.
This is useful if you wish to perform a task
after the report has been created (such as moving the data file it
created or emailing it).
For example, if you have created a report called
export.sty, and a file called export.mac exists in the same folder,
its contents will be executed after export.sty has finished.
Creating Scripts
Functions
Press this button to view a list of functions
available to use.
Operators
Press this button to view a list of available
language operators available for use.
Statements
Press this button to view a list of available
CAPITAL Business Script program commands/statements that may be
used.
Test
Will test the calculation to see if it contains
any errors that can be immediately detected.
Editor
Enter the calculation here. The calculation must
consist of one or more valid lines of CAPITAL Business Script.
A sample preface script might simply consist of a
series of variable declarations. For example:
Declare FirstDate Type
Date
Declare LastDate Type
Date
A postscript script might compare values and
reject invalid user input. For example:
* It makes no sense if
the end date is less
* than the start
date
If LastDate <
FirstDate
Echo
The date range you have specified is invalid.
Return FALSE
Endif
Return TRUE
____________________________
Related Topics
Capital Business Script
|