Brilliant Database Software - Home
Database software - Online Help System

Online Help System

Back to Brilliant Database Web-Site | Write to Support | Help Index

Scripting Basics

table border="0" width="100%" cellspacing="0" cellpadding="4" bgcolor="#00000077">
Scripting Basics


Using script you can create a small program that will be executed in response to certain actions (pressing a button, changing field value, etc.).

This chapter describes the basics of scripting and script creation.

To learn more abut the actual script editor, see the Script Designer chapter.

Script Elements

As an example we'll take the following script:

Every script has one or several instruction lines (in our example it has 12 lines). The program executes the commands downwards (starting from the first line to the last one). The program can skip lines if the condition of the If statement (lines 4, 10) is not fulfilled. It can also go to the specified line if it executes the Go To statement (line 6).

Thus, you can use the following lines in any script:


An action defines one action, such as creating a new record or changing a field value. To add an action to the script, use the Add Action button. Actions can contain different parameters specified in brackets after the name of the action. Beside standard actions, you can also execute User Functions - a script you create beforehand. Learn more about User Functions...

Some actions can record their result to a selected variable. For example, the Import From a Database action returns the number of imported records.

In the illustration above actions are represented by the following lines:

  • 5 - show message. The message text and message box title are specified as parameters.
  • 8 - increase the value of the Order Total field of the current record.
  • 11 - print a record. The parameters specify whether the preview window should be opened, what records should be printed and what report style should be used.

The action is specified by means of Action Editor that contains a description of parameters and convenient tools you can use to enter them. View the list of actions


Variables are used to store information. They have the following structure: [$VarName] For example, in this script the program:

  • first initializes the [$quantity] variable by means of the User Input field (line 3);
  • checks the value of this variable (line 4);
  • uses the value of this variable in the formula to change the value of the record field (line 8).

Some actions can also record their result to the specified variables. For example, the Add Record action records 1 to the variable if the record was added and 0 (null) if the record wasn't added:

To learn more about variables, see the Using Variables section.

If Statements

Conditional statements are used for carrying out actions only when some condition is true. For example, in the illustration above there are two conditional statements: one checks the variable quantity (line 4), the other one asks for the user's confirmation (line 10) and carries out action (line 11) only if the reply is affirmative. The following statements are available in the current version:

  • If Rule... then - the statement checks whether the ruleset is true. If a record type is specified, it also allows checking fields of the current record. Learn more about rules.
  • If Confirm(...) then - the statement displays the message with the specified text and the Yes and No buttons, and proceeds to carrying out the action if the Yes option has been selected. See line 8 in the illustration.
  • Else - this statement can be used only together with the If statement and displays a list of actions to be carried out if the condition of the If statement is false. See line 7 in the illustration.
  • Else If Rule... then - in contrast to else, the list of actions following the statement will be carried out only if the rule specified for this record and all the preceding If statements are satisfied.
  • End If - this statement closes the action of the If statement. See lines 9, 12 in the illustration.

    Double-click the End If line to collapse the If...End IF section into a single line. This feature is convenient when you work with large scripts:

Note. Conditional statements can have several nesting levels. Statements Else, Else If and End If are used only together with the If statement on the same nesting level. In Script Designer nesting levels are marked by the left margin.

In Script Designer conditional statements are highlighted blue.

To add a conditional statement, click the Add If/Else... button.

Cycles (For Each ... Next)

Cycles (loops) allow performing the same actions (cycle body) over different objects or under different conditions. For example, you can calculate the total of numbers 1 through 100, perform operations over several records stored in the recordset variable at once or print individual lines from a text.

For example, the following script will increase the value of Field A by one for all records received from the All Records query:

Learn more about cycles...

Go To Label

Use the Go To () statement to execute a specific part of the script marked with the label.

In our example, if the condition in line 4 is not satisfied, the program will go to the specified begin line (line 2) according to the Go To statement (line 6).

To add Go To or Label, click the Add Go To... button.

In Script Designer Go To and Labels are highlighted green with icons , .


Comments do not affect script operation in any way. Their purpose is to provide the script with additional information, such as a brief description of the script operation or the last modification date.

To add a comment line, click the Add Comments button.

In the text comments are highlighted green on the grey background. See line 1 in the illustration.

All topics in the "About Scripts" section: