Chapter 9. Scripts

Table of Contents

Basic Script Construction
Arguments
Operators
Inter-Records scripts

Scripts offer a mechanism to perform useful manipulations on information stored in the database. Scripts are generally used to calculated new values from information stored in a record or in a set of records. However, their functionality could be used in future versions of Pilot-DB to perform other routine tasks such as searching or sorting.

If you know how to use a simple programming language, have used formulas in a spreadsheet, or used an RPN calculator, it should be easy to learn how to use scripts and take advantage of all their functionality. Even if the ideas presented in the next few sections are completely new to you, it should not take you long to learn how to write simple scripts such as those to average two numbers. With that first step taken, more complex expressions will follow.

Scripts can be used to calculate field values based on the contents of other fields in the database. A script is a LISP-like expression containing one or more clauses, each of which takes the form of:

A script that contains a series of clauses:

([op1] [arg-1] ... [arg-n]) ([op2] [arg-1] ... [arg-2])

will return the result of the last clause.