Working with FPL Scripts
See also: Server-side
programming languages
Scripts are small programs which can be written in a choice of languages. This document covers the use of Forms Processing Language (FPL), the Ebase English-like scripting language. The full syntax of the language is shown in FPL Script Command Syntax. This language provides you with the ability to:
Each script can be associated with one or more events. These
events occur at different times during processing of an Ebase
form. The event model is described in detail in Understanding Ebase
Events.
Scripts are created and maintained using the script editor
as shown below. The script editor is opened by selecting an existing script in the hierarchy tree panel (Business Projects --> Project -->
Scripts --> Script name) or by creating a new script from the file menu
(File --> New --> Script). To delete and copy a script, right-click on
the name of the script in the hierarchy tree panel and choose an option from
the menu.
The toolbar contains the following icons:
|
Ctrl-S |
Save |
|
Ctrl-Shift-V |
Verify. Checks the script syntax. Errors are shown in a messages panel at the bottom of the page. |
|
Ctrl-X |
Cut |
|
Ctrl-C |
Copy |
|
Ctrl-V |
Paste |
|
Ctrl-F |
Find/Replace – shows the find and replace dialog |
|
Ctrl-Space |
|
|
|
Maintain Documentation |
|
|
Show information: shows userid and dates for creation, last update and import of this script |
|
F1 |
Help – shows this documentation page |
|
Undo/Redo |
See undo/redo. |
Contains the following:
|
Undo |
See undo/redo. |
|
Redo |
See undo/redo |
|
Ctrl-X |
Cut |
|
Ctrl-C |
Copy |
|
Ctrl-V |
Paste |
|
Ctrl-A |
Select All |
|
Ctrl-F |
Find/Replace – shows the find and replace dialog |
|
F3 |
Find Next |
|
Shift-F3 |
Find Previous |
|
Ctrl-L |
Go to line |
|
Ctrl-/ |
Toggle comment – comments or uncomments selected lines. |
The script assistant is designed to assist with the task of editing FPL scripts. It provides lists of form fields, tables, pages etc that can be selected and then inserted directly into the main script window at the current cursor position.
The script assistant is activated by holding down the Ctrl key and pressing the space bar, or by clicking the script assistant icon on the toolbar. Once activated, it will remain visible whenever any script is edited and will receive focus whenever Ctrl-Space is pressed from the main script panel.
When the script assistant is initially opened it will try to determine the form that is currently been worked on, and this form is shown at the top of the panel. The form can be changed by clicking on the change link.
Clicking on one of the buttons on the left side of the panel changes the list displayed on the right hand side. This selection can also be made by holding down the Alt key and entering the underlined mnemonic for the button e.g. Alt-P for pages, Alt-F for fields etc, or by using the up and down navigation keys, then pressing the Return key.
When a selection is made from the right-hand list panel, the selected text is inserted into the main script panel at the current cursor location and focus is transferred to the main script panel. A selection is made either by highlighting an entry in the list then pressing the Return key or the Insert button, or by double clicking on a list entry. The up and down keys can be used to browse the list.
The following lists are available:
Commands: list of FPL commands and keywords
Functions: list of available functions
System variables: list of all Ebase system variables
Resources: list of all external resources in the business view associated with the form shown at the top of the panel
Pages: list of all pages in the form shown at the top of the panel
Tables: list of all tables in the form shown at the top of the panel
Fields: list of all fields in the form shown at the top of the panel
Templates: list of FPL command templates showing the syntax for each command
Scripts which are created in the GLOBAL project are
accessible from all forms in all projects. Ebase will
always look in the current project first for any named script and, if not
found, it will then look in the GLOBAL project. This means that GLOBAL scripts
may be overridden by placing a script of the same name in the local project.
Global scripts may refer to any field or page, just like any
other script and, for the script to function correctly, those field and page
names must exist in the forms from which they are called.
Global scripts are also used by components. (See Working with Components for more
information)