Script Editor is the window where you may write procedures to execute custom scripts.
If you only need to write a single procedure, all you need is to type in the code into the editor box,
select triggering events if applicable and save changes.
The script editor will be opened in the following cases:
- When you create a "computed field" and choose compute type as "procedure"
- When you create a "script object" on Form Designer window
- When you create an "action button" on Form Designer window
- When you create a scheduled script
When you open the code editor for the first time it will create a default procedure called "Sub Main".
The default procedure name cannot be modified and this is the procedure executed when the triggering event happens.
Creating Additional Procedures
If you are a professional programmer and want to write longer and more complicated scripts, you may create additional procedures which can either be
a subroutine or a function.
Private Sub / Functions These procedures can only be called from other procedures created for the same script object.
Public Sub / Functions These procedures can be called from any procedures created for any object in your database.
This tab is only displayed when you are creating the script for a "script object" you placed on Form Designer window.
It allows you to choose the events which will trigger the execution of the script. Beware that, if you do not choose any event
for a script object, it will never be executed.
Load Record Event: Happens when the user just opens an existing record or starts creating a new record.
Create Record Event: Happens when the user starts to create a new record and clicks the save button for the first time.
Update Record Event: Happens when the user opens an existing record (or edits a newly created record) and clicks the save button.
Delete Record Event: Happens when the user clicks "Delete" button for the displayed record.
Field Enter/Leave Event: Happens when the user moves the cursor to any other field either via keyboard or mouse click.
Field Modified Event: Happens when the user changes the data displayed in a field.
Key Press Event: Happens when the user presses any key from the keyboard.
Periodic Timer Event: Happens periodically within specified time intervals in seconds.
Shared Variables: Variables you define here are visible from all procedures within the same script object. May be used only if you write multiple procedures
and you want share multiple variable values between procedures.
Suppress Runtime Errors: If checked, no error messages are displayed if the script terminates with a runtime error. That also means that you will not know
if the script is completing it's task or not.
Max Execution Time: The script will be automatically and forcefully terminated if the execution time exceeds the specified duration. You are recommened to
avoid setting this time longer than it should as an incorrectly crafted script code may load the processor and slow down the computer.
- Function Reference
- Example Procedures