Always use the proper Isah functions to update data in the database.
Ensure that you always build in an option to interrupt any loops. This prevents infinite loops occurring in the program.
Always state all variables at the beginning of scripts or procedures and choose logical names for variables. Not only will this prevent errors, it will also make scripts more readable. Stating the variables, however, is not required in VBScripting. It is therefore recommended that you use the Option Explicit statement to force explicit declaration of all variables in a script, for example:
Option Explicit
Sub Main()
Dim Text
Text = "Hello"
MsgBox Text
End Sub
This way you will never leave out the declaration of a variable. Please note that the Option Explicit statement must appear in a script before any other statements.
Where possible, it is recommended you use local variables, because they help prevent errors. The distinction between global variables and local variables is that global variables are declared at the beginning of the script and are valid and available for the entire script. Local variables, on the other hand, are declared at the start of a new procedure or function and are only available for that procedure or function.
Include sufficient explanatory remarks between lines. Use comments to give a short description of what the procedure does. Adding clear comments will make scripts easier to read and maintain. Use a preceding apostrophe (') to introduce comments, for example:
'This procedure performs a multiplication
Please Note: The apostrophe (') does not work when it concerns system scripts. In that case, the Rem keyword will be used to include explanatory remarks.
Divide large scripts into several procedures or subroutines.
Never use a statement such as "Select * from Table" in scripts.
Decimals are separated by a period (.) in scripts.
In all scripts except Report scripts and PCF scripts, the data from the 'current record' should be retrieved. These data are saved in the Recordobject.
Ensure that you have the correct version of the scripting engine. You can check this by running the following script:
To break a line that would otherwise become too long, use an underscore (_). The application then assumes that the two lines belong together.
When entering scripts, colors are automatically assigned to script lines. The color shows what type of line is concerned: a function, variable, comment, etc. For instance, if you enter a text enclosed in quotation marks (""), this text is automatically displayed in blue. Functions, variables, etc. that are not recognized by the system, will automatically be displayed in black. You can customize the color settings using the Script editor settings in the View menu of the Scripts screen.
Familiarize yourself with this Isah VBScripting Help file. It contains useful information and examples on how and where to use scripts.