Sie sind auf Seite 1von 224

Brilliant Database v9

User Guide

1
Content
Brilliant Database Basics...............................................................................................................8
Databases Basics.........................................................................................................................8
Brilliant Database Interface......................................................................................................10
Creating New Database.............................................................................................................13
Form Editor .........................................................................................................................14
Brilliant Database Differences..................................................................................................16
Working with Database...............................................................................................................17
Folders.......................................................................................................................................17
About Folders.......................................................................................................................17
Basic Operations with Folders.............................................................................................17
Folder Menu.........................................................................................................................18
Folder Layout.......................................................................................................................19
Table View...........................................................................................................................20
Filtering Folder Content.......................................................................................................21
Common Properties of a Folder...........................................................................................22
Properties of a Folder for Records.......................................................................................23
Records......................................................................................................................................24
Standard Operations With Records......................................................................................24
Working with Fields.............................................................................................................25
Attachments..........................................................................................................................28
Links.....................................................................................................................................29
Printing Records...................................................................................................................30
Find and Replace..................................................................................................................31
Sorting..................................................................................................................................32
Network and Users....................................................................................................................33
Users, Groups, Access..........................................................................................................33
Network................................................................................................................................35
Access Levels for Folders....................................................................................................36
Access Levels for DB Elements...........................................................................................37
Users and Scripts..................................................................................................................37
Network Troubleshooting.....................................................................................................38
ADB Server Monitor............................................................................................................39
Queries......................................................................................................................................41
Query Editor.........................................................................................................................42
Charts........................................................................................................................................45
Creating charts......................................................................................................................45
Chart Types..........................................................................................................................46
Chart Properties....................................................................................................................48
Formatting Labels for Charts...............................................................................................51
Calendars...................................................................................................................................52
Creating Calendars...............................................................................................................53
Calendar Properties..............................................................................................................54
Database Maintenance..............................................................................................................56
Database Optimization.........................................................................................................56
Backup..................................................................................................................................56
Database Status.....................................................................................................................57
Integration.................................................................................................................................58
Import/Export to Access, Excel, etc.....................................................................................58

2
Export to Word, HTML/Send Mail......................................................................................60
Import and Parse Web, Mail, Word, etc...............................................................................60
Synchronization........................................................................................................................61
Example of Synchronization................................................................................................62
Updating Databases..............................................................................................................64
Database Design...........................................................................................................................66
Form Designer...........................................................................................................................66
About Forms.........................................................................................................................66
Form Designer......................................................................................................................67
Managing Forms...................................................................................................................69
Form Properties....................................................................................................................70
Fields....................................................................................................................................73
Fields Basics, Creating and Deleting...........................................................................................................73
Common Properties of Fields......................................................................................................................74
Basic Fields..................................................................................................................................................77
Single-line text field...............................................................................................................................77
Password Field ......................................................................................................................................77
Numerical Field .....................................................................................................................................77
Mathematical Field ................................................................................................................................78
Date/Time Fields ...................................................................................................................................78
Drop-down list (combobox) ..................................................................................................................78
Multiline Text ........................................................................................................................................79
Flag Field ...............................................................................................................................................79
Multiselect Field ....................................................................................................................................79
ID Field ..................................................................................................................................................79
E-mail Field ...........................................................................................................................................80
URL Field ..............................................................................................................................................80
Static Fields..................................................................................................................................................80
Label.......................................................................................................................................................80
Button ....................................................................................................................................................80
Text Button ............................................................................................................................................81
Shape .....................................................................................................................................................81
Static Image ...........................................................................................................................................81
Image, File, Richtext Fields.........................................................................................................................82
Image Field.............................................................................................................................................82
File Field.................................................................................................................................................83
Richtext Field.........................................................................................................................................83
Relational Fields...................................................................................................................84
About Relations............................................................................................................................................84
Planning relational database ........................................................................................................................86
Many-to-many Relational Field...................................................................................................................87
Step-By-Step Many-to-Many Relational Database Creation ................................................................88
Working with the Many-to-Many Field ................................................................................................89
Many-to-Many Relational Field Properties ...........................................................................................89
What is Relational Set? .........................................................................................................................90
Simple Relational Field................................................................................................................................91
Relational Lookup Field.........................................................................................................................91
Link To Folder Field....................................................................................................................................92
Link to Folder Field Individual Properties.............................................................................................92
Using Link to Folder Field.....................................................................................................................92
Report Style Editor....................................................................................................................94
Report Areas ........................................................................................................................95
Report Style Editor Interface................................................................................................96
Report Style Properties.........................................................................................................98
General ........................................................................................................................................................98
Group and Sort ............................................................................................................................................98
Records Layout ...........................................................................................................................................99

3
Columns ....................................................................................................................................................100
Paper and Printer Tab ................................................................................................................................100
Common Properties of Report Style Elements...................................................................101
Positioning of Report Style Elements................................................................................102
Report Style Elements........................................................................................................103
Database Field............................................................................................................................................104
Formula Field.............................................................................................................................................104
Static Label, Shape, Image Elements.........................................................................................................105
Date/Time Field.........................................................................................................................................105
Page/Record Number.................................................................................................................................105
User Input Field.........................................................................................................................................106
Text Formula Field.....................................................................................................................................106
Export/Send Templates...........................................................................................................107
Export/Send Templates Editor...........................................................................................109
Template Properties ..................................................................................................................................110
Export/Send Templates Tags..............................................................................................111
Mailing...............................................................................................................................112
Import/Parse Templates..........................................................................................................114
Import/Parse Template Designer........................................................................................115
Drag and Drop Parsing Templates.....................................................................................116
Drag-and-drop Template special properties ..............................................................................................116
Import/Parse Template Properties......................................................................................117
General Properties of a Parser....................................................................................................................117
Fields/Variables Properties of a Parser......................................................................................................117
Specifying Text Source for a Parser..........................................................................................................119
Scripts Properties of a Parser.....................................................................................................................119
Using Quick Insert Menu for Creating Parsers..........................................................................................119
Parsing - Special Characters......................................................................................................................120
Automating Using Scripts.......................................................................................................121
About Scripts......................................................................................................................121
Scripting Basics..........................................................................................................................................121
Script Elements ....................................................................................................................................121
Actions .................................................................................................................................................121
Variables ..............................................................................................................................................122
If Statements ........................................................................................................................................122
Cycles (For Each ... Next) ...................................................................................................................123
Go To Label .........................................................................................................................................123
Comments ............................................................................................................................................123
Cycles.........................................................................................................................................................124
For Interval (1,2,3...) ...........................................................................................................................124
For each line from text ........................................................................................................................124
For Each record from recordset ...........................................................................................................125
For each match by regular expression .................................................................................................125
For each record from SQL query (External DB) .................................................................................126
User Functions...........................................................................................................................................127
Variables....................................................................................................................................................129
About Variables....................................................................................................................................129
Creating Text/Math/Date Variables.....................................................................................................130
Creating Recordset Variables...............................................................................................................133
Using forms for entering variables.......................................................................................................135
System Variables..................................................................................................................................138
Events.........................................................................................................................................................139
Script Designer...................................................................................................................142
Interface ....................................................................................................................................................142
Action Editor Interface...............................................................................................................................144
Script Debugging.......................................................................................................................................145
Calculations.............................................................................................................................146

4
Formulas Editor..................................................................................................................146
Functions Description.........................................................................................................148
List of Functions........................................................................................................................................148
Data Functions...........................................................................................................................................149
Date Functions...........................................................................................................................................150
Math/Logic Functions................................................................................................................................152
Functions for Recordset.............................................................................................................................155
Formatting Data......................................................................................................................156
Using Formatting................................................................................................................156
Formatting Numbers...........................................................................................................157
Formatting Date and Time.................................................................................................158
Formatting Text..................................................................................................................159
List of Text Format Flags ....................................................................................................................159
Examples of combining flags ..............................................................................................................161
Formatting Recordset Variables.........................................................................................162
Timers.....................................................................................................................................163
Creating HTML Frames..........................................................................................................164
Editing HTML content ......................................................................................................164
Adding User Function to HTML content ..........................................................................165
Toolbar Editor.........................................................................................................................166
Table Style Editor...................................................................................................................168
Table Style Editor Interface ......................................................................................................................168
Columns Tab .......................................................................................................................................169
Rows Tab .............................................................................................................................................170
Header Tab ..........................................................................................................................................170
Background Tab ..................................................................................................................................171
Sort and Group Tab .............................................................................................................................172
Text Formulas.........................................................................................................................173
Color Rules.............................................................................................................................175
Configuration Window ......................................................................................................175
Rule Wizard............................................................................................................................176
Interface .............................................................................................................................176
Types of the second argument ...........................................................................................176
Select Records Dialog Properties.......................................................................................178
General Tab .......................................................................................................................178
Visual Tab .........................................................................................................................179
Additional Tab ...................................................................................................................179
Creating Executable Applications............................................................................................180
Basic information....................................................................................................................180
Reviewing EXE project properties ........................................................................................181
General Tab ............................................................................................................................182
Features...................................................................................................................................183
My Menu.................................................................................................................................184
Icons and Logos......................................................................................................................185
Main Texts..............................................................................................................................186
Setup Options..........................................................................................................................188
Protecting Created Application...............................................................................................189
Application Project Folder......................................................................................................191
Creating Addons and Integration............................................................................................192
Creating and Using DLLs.......................................................................................................192
Using 3rd part Addons (Dlls) in Brilliant Database ..........................................................192
Creating 3rd Party Addons (Dlls) for Brilliant Database ..................................................192
SendMessage, WinAPI...........................................................................................................194

5
Receiving messages from external programs ....................................................................194
Sending messages to other programs (windows) ..............................................................195
Using Clipboard......................................................................................................................195
Miscellaneous.............................................................................................................................196
View Menu..............................................................................................................................196
Localization.............................................................................................................................197
Command Line........................................................................................................................198
Advanced View Settings.........................................................................................................199
Fonts ..................................................................................................................................199
Replace Tree ......................................................................................................................199
Misc Settings .....................................................................................................................200
Appendix A. List Of Actions.....................................................................................................201
Fields Operations....................................................................................................................201
Set field value (text).............................................................................................................................201
Set field value (math)...........................................................................................................................201
Change Relational Field Value.............................................................................................................202
Change Image/File Field Value............................................................................................................202
Clear Field............................................................................................................................................203
Extract Image/File................................................................................................................................203
Execute field's script.............................................................................................................................203
Open Input Dialog for Field.................................................................................................................204
Spell-Check Field.................................................................................................................................204
Records Operations.................................................................................................................205
Add Record...........................................................................................................................................205
Delete Records.....................................................................................................................................206
Clone Records......................................................................................................................................206
Move Records.......................................................................................................................................206
Sort Records.........................................................................................................................................206
Popup Record.......................................................................................................................................207
Change Access Rights..........................................................................................................................207
Print Records........................................................................................................................................207
Execute Query......................................................................................................................................207
Folders Operations..................................................................................................................208
Add Folder............................................................................................................................................208
Move Folder.........................................................................................................................................208
Rename Folder.....................................................................................................................................208
Change Folder Layout..........................................................................................................................208
Delete Folder .......................................................................................................................................208
Navigation...............................................................................................................................209
Select Folder.........................................................................................................................................209
Select Record........................................................................................................................................209
Move to Record....................................................................................................................................209
Switch to Sheet.....................................................................................................................................209
Move to field........................................................................................................................................209
Import/Export/Send Operations..............................................................................................210
Export/Send..........................................................................................................................................210
Export To a Database...........................................................................................................................210
Import From a Database.......................................................................................................................210
Connect to External DB.......................................................................................................................211
External DB Operation.........................................................................................................................211
External DB SQL Query......................................................................................................................212
Close External DB................................................................................................................................212
Network Operations................................................................................................................213
Share Database.....................................................................................................................................213
Deshare Database.................................................................................................................................213
Send Network Message........................................................................................................................213
Record Attachments Operations.............................................................................................214

6
Attach files to record............................................................................................................................214
Remove attachments.............................................................................................................................214
Create attachment.................................................................................................................................215
Save attachments..................................................................................................................................215
External Files Operations........................................................................................................216
Open File/URL.....................................................................................................................................216
Play Music/Video File..........................................................................................................................216
Write to file..........................................................................................................................................217
Read File...............................................................................................................................................217
Read File Attribute...............................................................................................................................217
Rename File..........................................................................................................................................217
Copy Files.............................................................................................................................................218
List Files...............................................................................................................................................218
Delete Files...........................................................................................................................................218
Create Directory...................................................................................................................................218
Delete Directory...................................................................................................................................219
Software Operations................................................................................................................220
Switch Topmost....................................................................................................................................220
Show Designer.....................................................................................................................................220
Show Help File.....................................................................................................................................220
Open a Database...................................................................................................................................220
Exit Program.........................................................................................................................................220
Miscellaneous..........................................................................................................................221
Show Message......................................................................................................................................221
Show 'Find' Dialog...............................................................................................................................221
Show Report Style................................................................................................................................221
Get web-page content...........................................................................................................................222
Create a Backup....................................................................................................................................222
RegExp Match......................................................................................................................................222
Win SendMessage................................................................................................................................223
Show Notification.................................................................................................................................223
FTP: Upload Files................................................................................................................................224
FTP: Delete Files..................................................................................................................................224
Execute User Function.........................................................................................................................224

7
BRILLIANT DATABASE BASICS
This section contains general information about databases and basics of work with Brilliant Database.

Even if you have experience at work with other databases, we recommend that you read the "Brilliant Database
Interface" and "Brilliant Database Differences" sections.

DATABASES BASICS
Basic Definitions

Database and Records

A database (db) is a structured collection of records or data that is stored in a computer system. It can be, for
example, a library database containing data on books and authors, or a company database containing data on
products, orders, employees and so on.

Structured information on one object (book, author or product) is called a record. For example, if there are 5 books
in our database, we can say there are 5 records in the database.

Record type (form)

What type of data is stored in a record is defined by a record type or a form. In case of a library database, there will
be two forms: book and author. In case of a company database, we will need correspondingly such forms as product,
order, employee and so on.

Simple and Relational databases

If all records in a database have one form (for example, in a contacts database), such database is called simple. If
there are several forms in a database that are related to each other (books and authors, orders and products and so
on), such database is called relational.

Fields

A form consists of fields. For example, the form 'Book' will have the following fields: author, cost, number of
pages, year of issue. And the form 'author' can have the following fields: name, date of birth and photo. Fields are
used to store, process and display data.

However, information stored in fields is saved not in a form, but in a record. A form only defines with the help of
fields with what kind of data we want to work.

There can be fields of different types, for example:

• Text field is used to store simple text data (name, address, description);
• Numeric field is used to store numbers (cost, pieces and so on);
• Math field does not store any data, but displays a result of calculation by the specified formula (for
example, Total=Cost*Pieces).

Changing the fields values is called editing a record.

8
Table/Form View

Traditionally, records are presented in the form of a table or a form:

In case records are displayed as a table, every line of a table represents a separate record. Displaying a record as a
form is more convenient for editing a record.

Operations with records

What operations can be performed in Brilliant Database?

• Creating, editing and deleting a record;


• Performing different calculations (get the total of an order, calculate the price with consideration of a
discount and so on);
• Printing records on paper (reports, invoices, stickers on envelopes with addresses and so on);
• Performing search by the database (all products over $100, books in the detective genre and so on);
• Forming and sending e-mail, exporting data to Internet, re-organizing data to other formats (Word, Excel
and so on);
• Automatically importing data from other sources (Internet, Outlook, other databases and so on).

9
BRILLIANT DATABASE INTERFACE
This chapter describes the Brilliant Database interface and main principles of work with the database.

Database Files and Sharing

After the program has been launched, a welcome screen allowing you to create a new database or open an existing
one will appear:

In Brilliant Database, one database is a single file. In this file the structure of the database, all records, folders,
pictures and so on are stored. Therefore, if, for example, you need to create a backup copy of a database, you can
simply copy the database file to a USB-flash or another location on your computer. By default, all new databases are
located in 'My Documents' folder.

If the database file is already open and you need to get access to the database from another computer (in case of
multi-user work), you should select Open networked database instead of Open local database. To learn more
about the multi-user work, see the Network chapter.

Software Interface

Once you have opened the database, the main application window will appear:

The main window is intended for work with the database. Creation and adjustment of the database (creation of
forms, adding of reports, editing of scripts) is performed with the help of visual editors.

The appearance of the program in many aspects is determined by the opened database, but it almost always has the
following elements:

Main menu

• File - the content of this menu is the same as in other programs: Open/Close a Database, Print, Import,
Export and so on. Note that Brilliant Database automatically saves all changes in the database file, so there
is no necessity to have the Save command.
• Design DB - this menu contains all tools for creating a database - the form editor, the report editor, the
script editor, timers and so on. If you want to change anything in the database - use this menu.
• Add - allows you to add a record or a folder to the database.

10
• Record - contains operations that can be performed with the current record (to learn more, see below).
• Folder - contains operations that can be performed with the current folder (to learn more, see below).
• Queries - this menu allows you to execute a query to the database or open the query editor. To learn more,
see the Queries section.
• View - allows you to adjust the appearance of the main application window, select the interface language
and used fonts.
• Help - contains links to the Help file, information about the program and license.

List of Folders

In Brilliant Database, all records are stored in folders (as regular computer files are stored in Windows folders). All
folders in a database are displayed in the tree-like list in the left part of the window.

The structure, names and folder icons are specified by the user. Usually, in one folder there are records of the same
type. For example, in Books folder there are records of the Books type; in Orders folder - of the Order type and so
on.

However, nothing prevents you from storing records of different types in one folder. Or, vice versa, records of one
type in different folders. For example, you can store records about orders in three folders: New, In Work,
Completed.

By default, all records can be easily moved between folders; however, you can disable this option in the folder
properties. Beside simple folders for storing data, there are special folders that can contain graphs, reports, calendars
and web-pages.

You can add a folder to the database using the Add menu.

To choose a folder (make it current), click its name. The properties of the current folder can be changed from the
Folder menu; the content of the folder is displayed in the central part of the application window. In case there are
records in the folder, they are displayed as a table or a form:

Table View/List of records

In this window all records that are stored in the folder are displayed as a table. For every type of records there can be
several types of table presentation (so called Table Style) that differ by columns and their order, colors and so on.

To change or set up the Table Style, select Folder > Table View or right-click any non-selected record.

Selected records are highlighted with another color. To select several records, press and hold the Ctrl or Shift key
and click all necessary records. If you right-click a record, the window of record operations will be opened.

To create a new record, use the Add menu. To delete a record, use the Record menu or simply drag it to the
Recycle Bin.

11
Current Record/Form View

In the lower part of the main window the current record is displayed for more detailed viewing and editing:

On the form there are fields for entering/viewing data and static elements (labels, buttons).

To start editing a record, simply change the value of any of the fields. At that, the record will become inaccessible
for other users (if several people work with the database). To finish editing a record, simply click on blank area of
the form or select another record. All changes will be automatically saved and the record will become accessible for
other users.

The behavior of fields can differ depending on their types and scripts underlying them. However, there are some
basic principles of work with fields:

• To start working with a field, click it.


• Most fields have the menu. To open it, right-click a field. For example, for a relational field the menu
allowing you to add a new record to it or create a new one will be opened.
• Some fields are processes with a double-click. For example, if you double-click a field with a date, the
calendar will be opened.

File Attachments

Every record can contain file attachments and unstructured links to other records. To access these functions, right-
click anywhere on blank area or use the Record menu:

Note that all file attachments are stored inside the database file itself. That is, if you copy the database file to another
computer with Brilliant Database installed, you will be able to work with files attached to the record. File
attachments significantly influence the size of the database. The restriction for the maximum size for one attachment
is 128 Mb, the maximum possible size of a database is 4 Gb.

Toolbar

In contrast to many other programs, in Brilliant Database the appearance and actions performed by clicking toolbar
buttons are fully defined by the user and are a part of the database. In other words, every database can have its own
toolbar. For example, for the product catalog these can be buttons such as 'Print Catalog' and 'Export to Web', and
for the address book - the button for quick search by the name.

You can change an action or a script that will be performed at clicking the button, add or delete a button in the
toolbar editor. The easiest way to open it is to right-click the toolbar. You can also create your own toolbar
separately for every folder.

In Brilliant Database, you will not find a list of hot keys as they can also be specified by the user to make work with
a specific database more convenient. By default, only two hot keys are specified - Print (Ctrl+P) and Add Record
(Ctrl+A). You can also change or add your own hot keys in the toolbar editor.

12
CREATING NEW DATABASE
This chapter illustrates how to create a simple database from scratch. As an example, let us create a simple book
database.

To create a new database, click the New Database tab on the welcome screen or select File > New... from the main
menu:

1. Specify the file name in which the database will be stored (use the Browse... button). Additionally, you can
set a password for administrator's access, and then nobody except you will have access to your database.
2. Click the Finish button, and a new empty database will be created.
3. There should be at least one form in the database. The form defines the type of records with which you
want to work. Therefore, after you create a database, the form editor will be displayed. Click Next to pass
to it:

4. In the list of form templates, select the one you need. If there is no suitable template, use the 'Blank' one.
Let us select the 'Book' template.
5. Click the Next button and check the correctness of the form name; then click the Finish button. You will
see the created database with one working folder and the only record in it:

13
FORM EDITOR
The form editor is a key tool in database creation. It allows creating new forms and editing already existing ones. To
access it, as well as other database editors, use the Design DB menu:

Let us open it and edit the form according to our requirements:

The interface of the form editor is fixed and can be divided into the following parts:

• In the upper left part of the window there are toolbars and a palette of fields that can be added on the form.
• Under them there is a list of forms that already exist in the database. Right now we have only one form.
• In the central part there is the form itself.
• Over the form there is the properties window for the selected object (the form or some field).

Deleting Fields

Let us delete unnecessary fields 'Year', 'ISBN', 'Notes' and their labels. To do this:

1. Select an element by clicking it;


2. Select Edit > Delete from the menu or click the corresponding button ( );
3. Confirm deletion.

The form will take the following shape:

Creating Fields

We want to add the following fields - 'Acquisition Date', 'Cost' and 'Location' - to memorize where the book is
located.

To add a field:

1. On the elements palette on the left, click the button of the field type that you want to add (for example, -
date, - number, - drop-down list).
2. Click on blank area on the form;
3. In the displayed window, enter the field name;

14
4. In the element properties window (at the top), edit field parameters (font, colors, behavior, access and so
on).

Newly added elements will appear on the form:

Field Properties

Element properties are distributed over 8 tabs. The content of 7 tabs is the same for all elements (color, font, tooltip,
scripts and so on). The first tab 'Individual Properties' is unique for every field type and allows setting its specific
properties, for example:

• For a date:

• For a number:

• For a list:

Adding Labels

You can create labels for fields as well as fields themselves (by selecting the 'Label' element on the palette of
elements). But it is easier and faster to make it via the menu of an element:

1. Right-click a field;
2. In the displayed menu select the 'Create label for the element' command:

3. The label will automatically appear on the left of the field.

Conclusion

Therefore, our field will take the following shape:

Close the form editor. You will see that the record in the database has been changed. So, we learned how to edit
forms and create simple fields. In a similar manner, you can add images, buttons, flags, relational fields on the form
and so on.

15
BRILLIANT DATABASE DIFFERENCES
This chapter will be useful for those who already have experience in working with databases: it contains description
of main differences of Brilliant Database from other classic relational databases.

Tables and Forms

In case of a usual database, at first, tables are created. After that, entry forms for tables can be created.

In Brilliant Database, you first create a form in the visual editor by dragging fields of different types from the fields
palette onto it. And only after that records created in this form can be displayed as a table.

Such approach allows fastening the process of a new database development.

No Tables, but Folders?

In a usual database, all records of one type are stored in one table.

In Brilliant Database, there are no tables in traditional understanding. There is representation of records in the form
of a table, as it is common for usual databases. But records themselves are stored in folders. There can be records of
one type, as well as records of different types in a folder. A folder can also have nested folders within.

This does not limit possibilities of Brilliant Database in comparison with usual databases, but allows you to:

• Simply implement a tree-like structure of storing, displaying and working with data in the form of tree of
folders;
• Group different types of data in one folder. For example, make a separate folder for each project, in which
there will be records of the Documents, Reports, Photos, Tasks types and so on.
• Easily move and group records by folders. For example, you can store records on orders in three different
folders: New, In Work and Completed.

Relational Fields

All you need to do in Brilliant Database to create a relational link between two types of records is to add a relational
field on the form. The program will make all the rest by itself. Relational fields can be of two types: simple (one-
way single connection) and many-to-many (two-way multiple connection).

Multi-user work

In Brilliant Database, multi-user work is realized by the client-server technology. The main user opens a database on
his or her computer as usual and selects the 'Share Database' option. Other users connect to the database by selecting
not the 'Open Local Database' option, but the 'Open Networked Database' option and entering the address of the
remote computer on which the database is opened. At that, computers can be in one local network, as well as at
different points of the Earth.

When working with a remote database, the user has access to the same possibilities as when working with a local
database. However, for every group of users you can set access to different parts of the database, for example:

• Hide fields, buttons, reports and so on;


• Prohibit editing of specific fields or the whole records;
• Prohibit access to some folders or just hide system folders.

16
WORKING WITH DATABASE
This section contains information about work with an already created database and its maintenance.

As the appearance and behaviour of the program are determined to a large extent by the database itself, a number of
described options can be blocked by the author of the database or implemented in a different way. For example, the
author can block a possibility to move records between folders.

FOLDERS
This section describes methods of work with folders intended for storing records, and their properties.

ABOUT FOLDERS

In Brilliant Database, all records are stored in folders (in the same way as computer files are stored in Windows
folders). All folders available in the current database are displayed in the tree-like list in the left part of the program.

The structure, names and icons of folders are fully defined by the user. Usually, one folder contains records of one
type. For example, Books folder contains records on books, and Orders folder - records on orders.

However, nothing prevents you from storing records of different types in one folder. For example, you can create
Archive folder and store all out-dated records in it. Or, vice versa, store records of one type in different folders. For
example, store records on orders in three folders: New, In Work, Completed.

By default, records can be easily moved between folders; however, this possibility can be blocked in the folder
properties. Beside simple folders, there are folders that can contain charts, reports, calendars and web pages.

To add a folder to the database, use the Add menu.

To select a folder (make it current), click its name. Properties of the current folder can be changed using the 'Folder'
menu; the content of the current folder is displayed in the central part of the window.

BASIC OPERATIONS WITH FOLDERS


Creating Folders

To create a folder, use one of the following methods:

• Select the Add->Simple Folder menu item from the main menu to create folder for storing records.
• Select the Add->Special menu item from the main menu to create a chart, calendar, HTML page or a
folder with a query results.
• Right-click a necessary folder and select Add->Simple Folder from the menu.

Modifying Name, Icon, Color, Security Settings

To set these folder properties, you can either use the Folder menu items or double-click the folder caption:

17
• Double-click the folder icon to set the folder icon.
• Double-click the folder caption to set the folder caption.
• Double-click the empty area of the folder caption to set the background color for the folder caption:

Moving Folders

You can move folders in this program in the same way as moving objects in Microsoft Windows: select the folder
you want to move and drag it to the required position.

Cloning Folders

To create a folder copy, right-click it and select Clone Folder from the menu. At folder cloning, only folder
properties will be copied, but not the records in the folder. Cloning a folder can be useful if it is necessary to create a
number of similar folders (for example, charts).

Deleting Folders

To send a folder into the recycle bin, select it in the folders list and press the Del key on your keyboard or
alternatively drag-and-drop the folder to the recycle bin. To permanently remove it, clear the recycle bin by right-
clicking its icon and selecting Empty Recycle Bin from the context menu.

FOLDER MENU
The Folder menu contains tools for work with the current folder. To access it, use the main menu or right-click a
necessary folder:

• Table View and Layout - these menus are responsible for the way in which records in the folder will be
presented (as a table/form, what columns will it have and so on). Learn more about Table Styles or Layout.
• Sort Records - sorts all records in the current folder by specified fields. Learn more about sorting...
• Find Records - opens the search and replace window to find and replace text in records. Learn more about
search/replace...
• Sort Subfolders - if the folder has subfolders, this menu allows you to sort them in the ascending or
descending order.
• Rename Folder... - allows you to change the folder name.
• Access Level... - opens the window for setting the access levels to the folder for different groups of users.
Learn more...
• Folder Properties... - opens the window for specifying main folder properties (name, icon, scripts and so
on). Learn more...

18
FOLDER LAYOUT
The folder layout defines how records from the folder should be displayed.

To change the layout, select the Layout item from the Folder menu:

You can use one of the following 5 layouts:

• List and Form: Vertical Split A. Records are displayed as a list (at the top) and a form (at the bottom):

• List and Form: Vertical Split B. Records are displayed as a list (at the bottom) and a form (at the top):

• List and Form: Horizontal Split. Records are displayed as a list (at the left) and a form (at the right):

• List only - only a list of records is displayed:

To open a record for editing, double-click it, and it will be opened in a new window.
• Form only - only one record is displayed as a form:

This type of displaying is convenient if there is only one record in the folder (for example, a greeting form
with command buttons).

For vertical split you can turn on the "remember vertical split rate separately for each form" mode from the "View-
>Advanced...->Misc Settings" menu item.

19
TABLE VIEW
Introduction

Records in a folder can be displayed as forms and as tables.

In what way records should be displayed in a table (columns, fonts, color settings, etc.), is defined by the 'Table
Style' selected for the table.

For every type of records you can create a number of Table Styles. For example, one to display main fields of a
record:

another to display photos from records:

Table View

To control Table Styles, a folder has the 'Table View' menu. To access the 'Table View' menu, use the 'Folder' menu
or right-click a table with records:

The options of the menu are split into three groups:

• The upper group contains the list of Table Styles available for the records of the folder (Detailed, Photos,
Descriptions). For all types of records style Simple List can also be applied to display records of different
types in one table. For example, when applying this style to a table containing records of books and
relevant authors, the table will display the names of the books and the names of corresponding authors:

The main drawback of the Simple List is the inability to display the fields specific to each record type
(e.g., the number of pages in the book or the author's birth year). Such fields can be displayed only by
applying the style that was specially created for the given record type, e.g., for a book:

20
• To add a new style select the Create New Table Styles... option that can be found in the middle of the
context menu.
• Click the Columns... button to select the columns to be displayed in the table.
• Click the Appearance... button to open Table Style Editor and customize the appearance of the table
records (set colors, alignments, fonts, etc).

Notes

Using the 'Columns...' menu, you can select even those fields, that are hidden on the form, for displaying. To
prohibit the user to select specific fields, define them in the form editor as 'System' (in the 'Edit and Visibility'
section of fields properties).

Only the user having Administrator rights can edit Table Styles.

To delete a Table Style, open it by clicking the 'Appearance' button and click the 'Delete' button in the lower left part
of the displayed window.

At editing Table Styles for a folder some options are not available (grouping records by fields, sorting, filtering,
getting subtotal and so on). You can use them only in queries.

FILTERING FOLDER CONTENT


To filter records in a folder:

1. Left click on the column's header you want to filter records by;
2. Select the "Add Filter for [Column_Name]" menu item:

3. Configure the filter rule:

4. Press the "Finish" button. All records insufficient to the filter will be hidden.

Columns with a filter market with the asterix symbol and the gradient. To configure or remove the filter (or to
remove all filters) click the column again:

All filters will be automatically removed then you close the software.

21
COMMON PROPERTIES OF A FOLDER
Introduction

Folder properties depend on its content (records, calendar, chart and so on). In this section we will describe
properties common for all folders (name, icon, toolbar, scripts and so on).

Specific folder properties are described in the following sections:

• Properties of a folder for records


• Chart properties
• Calendar properties
• Properties of a folder for an HTML page

To open the Properties window, select the Folder Properties menu item in the Folder menu. The menu can be
called either from the main menu, or by right-clicking the folder icon.

General Tab

Besides name and folder color\icon, it is possible to enter folder comments here and create an toolbar for the folder.
The toolbar will be shown under the folder title when this folder is selected. This gives an opportunity to perform
actions directly connected to the content of this folder.

Beside creation of the toolbar separately for every folder, you can select the Use parent folder toolbar option - in
this case, the folder will have the same toolbar as its parent folder has. This will allow you to avoid repeated creation
of a toolbar with the same functions for several folders.

Scripts Tab

On this tab, you can select a script that will be executed when the user passes to the folder. For example, in this
script you can initialize variables for building up a chart or select to pass to the last record in the folder.

22
PROPERTIES OF A FOLDER FOR RECORDS
This section describes properties specific for a folder that contains records.

To open the Properties window, select the Folder Properties menu item in the Folder menu. The menu can be
called either from the main menu, or by right-clicking the folder icon.

Records Options Tab

• Show - defines in what way records stored in the folder should be displayed. To learn more, see the Folder
Layout section.
• Type of records - defines what type of records can be stored in the current folder. You can select a specific
type of records or allow storing any records in the folder. If a specific type is selected, you will not be able
to move or create a record of a different type in this folder.

Note. In the form editor, you can specify a default folder for every record (form). At that, all new records
created from the 'Add' menu will be stored to this folder. The 'Default folder' property for a form and the
'Type of records' property for a folder are independent.
• Set "No Records" text... - this button allows you to specify text that will be displayed instead of records if
they are not available.

The following options block a possibility of manual performing of some standard operations with records. However,
this does not influence work of scripts with records in any way. For example, you can block moving records from
the folder using the mouse, but create a button that will move a record to a specific folder.

• Block records drag-and-drop - prohibits moving records from the current folder using dragging with a
mouse.
• Block records delete - prohibits a possibility to delete records from the folder manually (by pressing the
'Delete' key or using the Record > Delete menu).
• Block records add - prohibits simple adding of records to the folder by using the 'Add' menu or pressing
the 'Insert' key.
• Block clone/convert/fill/default features - prohibits calling corresponding functions in the menu.

23
RECORDS
Records are intended for storing and working with information in the database. This section describes work with
records in Brilliant Database.

STANDARD OPERATIONS WITH RECORDS


Creating New Records

To create a record, use one of the following methods:

• Select the Add >[Record Type] menu item. In this case, a record will be stored in the current folder or in
the folder set as default for this type of records. You can select a default folder using the Form Editor, in
the form properties.
• Make the records list active and then press the Ins key on your keyboard. This option can be blocked in the
folder properties.
• Create a button on a form or toolbar with the Add Record action.

Default Values

At creation of a record, all its fields will be initialized with default values. To set these default values, do the
following:

1. Create a record;
2. Fill its fields with values that will be used in future as default values.
3. Right-click the created record and select Set Record Name as Default from the displayed menu.
4. Now these values will be used for all new records.

Cloning Records

To create an exact copy of a record (or records):

1. Select one or more records.


2. Right-click one of the selected records and select Clone Records from the displayed menu.

Note: At cloning, content of many-to-many relational field is not cloned. If you want to create a clone of a record
with a many-to-many relational field, you can do it by creating a button with a corresponding script.

Moving Records

You can move records in this program in the way similar to moving objects in Microsoft Windows: select the
records you want to move and drag-and-drop them to the required location. This option can be blocked in the folder
properties.

Converting Records

Converting stands for transformation of a record into another type, or data migration from one record field to
another:

1. Select the records to convert;


2. In the Records menu select the Convert Selected Records... option;
3. If there are several record types (forms) in the database, select the record type to transform the selected
records to (the initial record type can be preserved);

24
4. Specify the fields to convert the fields of the selected records to:

5. Click OK.

Note. The data won't be converted if association between different data types cannot be set (e.g., between an image
and a text);

This option can be blocked in the folder properties.

Filling Records

By Filling Records we mean filling the same field of different records with the same data:

1. Select the records to be filled with the same data.


2. For the current record, set the field value to the one to be applied to all selected records.
3. In the Records menu select the Fill Selected Records... option.
4. Choose the field common for all records.
5. Click OK.

You can also simultaneously change field values in several records at a time by means of a query, if you create the
'Execute script for each record' script in the query properties, on the Actions tab.

Deleting Records

To send records into the Recycle Bin, select them in the records list and then press the Del key on your keyboard or
just move them to the Recycle Bin. To permanently delete the records, clear the Recycle Bin. To do that, click the
Recycle Bin icon with the right mouse button and select Empty Recycle Bin from the context menu.

WORKING WITH FIELDS


This section describes peculiarities of work with some types of record fields. You can change appearance and
behaviour of fields using the Form Editor.

Simple Text Field

The content of this field can be highlighted red if for this field a mask is specified and it does not correspond to the
entered text. For example, if mask "###-##" is specified (three digits, a dash and three digits) and only 2 digits are
entered, such text will be highlighted red and the value will not be saved.

At editing a field with a mask, the program will automatically enter necessary characters and block not permissible
ones. In the example above, once 3 digits are entered, the program will enter a dash and will not allow entering a
letter.

Mathematical Field

If for this field the 'Dynamic' type is set, the formula used in it can be specified independently for every record. To
change the formula for the current record, double-click a field. At that, the Formula Editor will be opened.

25
Date Field

To change the date, double-click the date field:

The yellow color shows the current date, while the red color stands for the selected date.

Drop-down Combo Field

For this field, changing of possible values in the list can be allowed. In this case:

• To enter a new value, select a field and press Enter.


• To change a list of values, select Edit list of values... located at the end of the list:

The content of the list can depend on the content of another list, for example, Car Make - Model or State-City.

Multi-line Text Field

If 'Spell Check' is selected for this field, then, in case there are words, that are absent in the standard dictionary, in
the text, a special window will be displayed once the text is entered:

• Suggestions - displays a list of variants of correct words spelling. The list is taken from the dictionary
program.
• Replace - replaces a strange word with the word selected from the list.
• Add Word - adds a strange word to the user dictionary of Brilliant Database. After that the program will
not regard this word as an incorrect one. The user dictionary is stored in "spell_check_dictionary.txt" file,
in Documents and Settings\User Name\Application Data\Brilliant Database... folder. You can manually
enter here all specific words.
• Skip - ignores the word in the text.

26
Multiselect field

This field allows you to select a number of values from the list. To add or remove a value, just click it.

Text Button

This field looks like a usual field for storing text. However, if you enter text there and press 'Enter', a specified script
will be executed (for example, searching for records or adding in the order goods by the specified number). Learn
more about Text Buttons...

Image Field

To get access to the image menu, right-click an image:

• Import image from file - used to add an image to the database from a graphical file (BMP, JPG or GIF);
• Import image from clipboard - used to add an image to the database from the standard clipboard;
• Acquire image - used to add an image to the database from an external source such as scanner or camera.
• Save image as - used to save the current image as file on a hard drive or on a disk;
• Copy image to the clipboard - used to copy the current image to clipboard. Afterwards you can easily
insert it in any program;
• Open image - used to open an image in a separate window;
• Delete image - used to delete an image from the database.
• Convert to jpeg - used to convert an image into the small-size JPEG format.

File Field

This field can store any files within. At that, the database will store not a link to the file, but the file itself. That is,
adding a file extends the size of the database file.

On clicking the field:

• If a file is not specified, the window to browse to a file will be opened.


• If a file is specified, it will be retrieved from the database to a temporary folder and will be opened with the
standard program. If the file has been changed, when the work with it is finished, Brilliant Database will
offer to update the file in the database itself. Therefore, you will not have to add it to the database once
again.

To access additional functions, right-click the field:

27
Rich-text Field (RTF)

At work with this field, a special panel for formatting and changing properties of the selected text fragment will be
displayed:

Left to right:

1. Font name
2. Font size
3. Bold text
4. Italic text
5. Underlined text
6. Upper case
7. Lower case
8. Text color
9. Text highlight color
10. Alignment: Left
11. Alignment: Center
12. Alignment: Right
13. Alignment: Justified
14. Decrease indent
15. Increase indent
16. Decrease line spacing
17. Increase line spacing
18. Format selected text as a list

Relational Fields

Click to learn more about many-to-many relational fields...

ATTACHMENTS
Using Brilliant Database you can attach any files to records. For example, you can insert photos, documents, mp3
files to a record. These files will be stored inside the database file, extending its size, and will be called attachments.
Beside storing files as attachments, you can store files in special fields:

• Image Field - field for storing and viewing images;


• File Field - field storing any files.

Adding file(s) to a Record

Method 1. Select files and move them onto the record header:

Method 2. Use the Record context menu that can be shown by right-clicking the record name in the records list or
in the record window:

28
Opening, Saving and Deleting Attachments

If a record contains attachments, the record header will change its appearance. To open the attached file, select it
from the drop-down list available by pressing the Attachments button:

At that, when you have finished working with the file that has been changed, Brilliant Database will offer to update
the file in the database itself, so that you don't have to add it to the database once again.

Select the Save/Open/Delete Attachments menu item to open the attachments manager window:

• Delete selected: used to delete the selected attachments;


• Open selected: used to open the selected attachments using default associated applications;
• Save selected: used to save the selected attachment(s) on to a disk as files.

LINKS
A link is a simple tool to quickly create a relation between records. Links represent unstructured relations, and
cannot be used for processing by means of scripts. To create structured relations between records (for example,
Book-Author, Client-Order-Goods), use relational fields.

To add a link to a record, use the Record > Add Link menu item:

To open the links menu, click the icon in the left part of the record header:

Click the link to follow it or select the Delete Link(s)... menu item to delete the links.

29
PRINTING RECORDS
You can print records using one of the following methods:

• Select File > Print... from the main menu;


• Select Queries > Print Query Result from the main menu;
• Create a button on a form/toolbar with the Print Records action.

To print records, it is necessary to create at least one Report Style defining how records should be printed on the
paper.

Print Preview Window

1 - Window for selecting report style and records for printing

• Print specifies the records to print (current, selected, all in the current folder, query results, etc). At
printing records from a variable, this list can be inaccessible.
• Records Type specifies the type of the records to print;
• Report Style specifies the report style (to learn more, see the Report Style Editor section) used to print
records.

2 - Control window

• Printer Setup... - use this button to configure printer properties. Alternatively, you can click the printer
name;
• Help - show this page;
• Cancel - cancel printing;
• Print - print the records;
• Modify Report Styles - click this button to open Report Style Editor and correct the selected report style.

3 - Additional Options

Use this window to specify User Input strings used for the current report style. Use the Update button to apply
changes.

4 - Print preview window

Use this window to preview the data before printing. To scale the image, use the Scale + and Scale - buttons. Use
the [<<], [<], [>], [>>] buttons to select the page you want to view.

30
FIND AND REPLACE
Brilliant Database offers a possibility to accomplish simple search and replace in all types of records and folders at a
time. This option is very useful if you need to quickly find or replace some text.

For structurized and fast search of records it is recommended to use queries.

To open the Find/Replace window, select the Folder > Find Records from the main menu.

Find/Replace Dialog

Find Configuration

• Find - enter any string value (a word, a phrase etc.) you wish to search for. In this string you can use AND/
OR operands to make complex search, for example:
o Apple AND Green
o Apple OR Pear AND Green
o Apple OR Pear OR Banana

Please note, Brilliant Database checks all the rules from left to right ignoring the AND priority.

• Whole word - specifies whether or not the search string should be separated from the text;
• Math case - specifies whether the search is case-sensitive (the word Ball is not equal to the word ball);
• Include subdirectories - if the item is checked, program will search for records also in sub-folders;
• Folder - specifies the folder in which records will be searched. Click the "..." button to browse for the
required folder or click the "\" button to search in the root folder;
• Field - specifies the field you want to search through;
• Search Results - to view a record from the search results list, double-click it. The record will be opened in
a new window or in a main window. You can configure this in the "View->Advanced..., Misc Settings"
dialog. Right-click this field to configure the table style for the search results window.

Replace Configuration

To display the search options, click the Replace check box. In the displayed text window 'Replace With' enter the
text with which you want to replace the text specified in the Find window.

Buttons Description

• Find - click this button to start search;


• Replace - on clicking this button a menu with two items will be displayed:
o Replace in All Records - accomplish replacing in all found and displayed records in the 'Search
Results' list.

31
o Replace in Selected Records - accomplish replacing only in the selected records in the 'Search
Results' list.

Note: Only the text, for which search was accomplished, will be replaced.

• Save Results - click this button to copy the search results to the query results window. Afterwards you can
work with them as you usually do with query results (print, sort, view):

SORTING
You can sort records in a folder using one of the following methods:

• Click the header of the field that should be used for sorting. In the displayed menu select the order of
sorting (ascending or descending):

• Use the Folder > Sort Records... menu item.


• Create a corresponding toolbar button or a form button with a script containing the Sort Records action.

Note. Sorting can be incorrect in case of using incorrect elements for data storage (for example, if you store
numerals in a text field). To migrate data from one field to another, use the Records - Convert Records menu item.

Sorting Configuration

The sorting set-up window allows sorting by four fields. To change the sorting order by a selected field, use the Z-A
check box to the right of the field name.

32
NETWORK AND USERS
This section describes basics of multi-user work with the database.

USERS, GROUPS, ACCESS


The present software allows a number of users to work with the same database.

It is possible to assign different access rights for every user (for example, you can allow only reading for some
users, and also allow changing records for others). Practically for all elements of the database, you can specify a list
of users who will have access to such elements. For example, you can hide some buttons or folders or block a
possibility to edit some fields of a record for a specific group of users.

Configuring Users, Groups and Login Method

By default one Administrator user and several Guests users are created for a new database. The authorization
window is not displayed as no password is set for the Administrator user by default.

You can specify users settings, passwords and the method of logging into the database in the Users and Access
window. To display this window, select File > Users and Access... menu item:

Database Users and Groups

On this tab you can edit users and users groups. Users are united into groups for convenience at access rights setting.
For example, we can create the Operators group that will contain 3 users, and allow access to specific folders of the
database for this group. If we need to add a new user with the same rights, we will simply create a new user in the
Operators group.

For this reason access rights are set not for separate users, but for a group of users.

To create a new user or a group of users, click the New button.

Group Properties

• Name - name of the group. At user’s logging into the database this name is passed to the system variable
[$_user group name].
• Access Level - the given field is the main field of a group. It determines the access level for users of this
group by default. (See the Access Levels chapter above). The following values are possible:
o No Access - access to the database is prohibited for users of this group;
o Read Only - users of this group can only view folders and records, if other is not specified for
such folders and records;

33
o Read and Write - users of this group can only view and edit folders and records, if other is not
specified for such folders and records.
o Administrator - users of this group have full access to the whole database regardless of access
rights settings for separate folders, records or fields.
• Own new records - selecting this check box allows the users of this group to become owners of records
that they create. Otherwise the Administrator will become the owner of the record. The difference between
the owner of a record and any other user is that the owner can change access rights for his or her records.
Only the Administrator can change the owner of a record or a folder.

• Description - in this field you can enter any comments for a group.
• Block edit of the folder structure - if this check box is selected, the user cannot change the
existing structure of folders in the database, that is, create, delete, move folders or change folder
properties.

User Properties

• Active - select the check box for the user to have access to the database;
• Group - use this list to change the group to which the user belongs;
• Login - user name that should be entered at logging into the database.
• Password - password for the selected user. If the password is not entered for the Administrator, the
authorization dialog, in which the user is selected, will not be displayed and you will automatically log in
as the Administrator at the database loading.
• Comments - in this field you can enter any comments for the user.

Login Method

On this tab you can specify the method of logging into the database:

• Always show login screen - if this check box is selected, the authorization dialog will be always displayed
(even if there is no password set for the Administrator of the database);
• Hide list of users - if this check box is selected, the authorization window displayed at logon will not have
a list of available users and you will have to manually enter the user name under which you want to log into
the database.
• Login screen greeting - this field allows specifying a greeting that will be displayed in the authorization
window when the users try to log into the database.
• Allow basic users to change their passwords - if you caheck this flags all users of the database will be
able to change their own passwords from the file menu:

34
• Preview... - press this button to preview how the authorization dialog window will look like:

Group Features

On this tab you can disable any software feature for a group of clients. The features is grouped by main menus in
which they are located. Unchecking a flag will remove this feature from the main menu for the selected group.
However, it still can be executed by a script. For example you can bolck a possibility to print any database records
by the "File->Print..." menu command, and create a button on a form with the "Print Records" action.

NETWORK
This application can provide simultaneous work of several users with one database based on the client-server
technology. It means that the main user (further referred to as Server) should open the local database as a file using
the standard File > Open... menu item and make it accessible for other users connection (further referred to as
Clients): File > Share Database.... To work with a remote database, clients should select the File > Open
Networked Database... menu item.

To learn more about setting different access rights for different users, see the Users and Access section.

Server Mode

The database can be switched to the server mode only if it is opened by the user having the Administrator access
level.

To work with the database in the server mode, you should:

1. Open an existing database using the File > Open... menu item.
2. Select the File > Share Database menu item.
3. In the displayed window specify a port on which the server will be created. By default port 6420 is used.
You may have to choose another port in case you have already switched one database on the computer to
the server mode, and want to switch another database to the server mode on the same computer.
4. You can check the "Monitor software with ADBServerMon" flag (if available) to run an independent
application, that will monitor the database status, notify if something wrong and restart the server
automatically.
5. Press the Finish button.
6. To make the DB inaccessible to the network connection, select the File > Disallow Network Connections
menu item.

To quickly switch the database to the server mode, you can create a button with the Share Database action on the
toolbar.

35
If you want the database to automatically switch to the server mode at startup, create a timer with the Share
Database action that will be executed at the database loading.

To view a list of clients working with the database at present, use the File > Database Status… menu item on the
Connected Clients tab.

Client Mode

To connect to the database opened in the server mode, you should:

• Select the File > Open Networked Database... menu item


• In the displayed window enter the address of the remote DB and the port on which the database was
created. This information is passed to the server at execution of the Share Database operation.
• In this window it is necessary to specify the user name and password under which you want to log into the
database. If the entered user name or password is not correct, you will be asked to re-enter them.
• Click the Finish button.
• After connecting to the database, you will be able to work with a remote database just as you work with a
local database.
• To disconnect from the DB, select the File > Close menu item.

You can create a shortcut on the desktop for quick connection to a remove database. To do so, select the File >
Open Networked Database... menu item and click the Create shortcut on desktop for quick connection link. In
the displayed window specify the name of the shortcut for a remote database. Now you should only double-click the
shortcut on the desktop to open a remote database.

Working with networked database

Work with the networked database is in fact the same as work with a local database. The only difference in work via
network is that two users cannot edit the same record at the same time. If, for example, one user is editing a record
and another user is viewing it, the latter one will get the Editing By UserName subscription at the top right corner
of the record which means that the record is being edited by another user at the moment and can be accessed only in
the read-only mode.

To learn how to create users and groups of users and set different access rights for them, see the Users and Access
section.

ACCESS LEVELS FOR FOLDERS


The Brilliant Database uses the hierarchical system of determining access rights (the same as used in Microsoft
Windows). Let's imagine we have the Parent folder that contains the SubA and SubB subfolders:

If you set the Read Only access level for the Parent folder, this level will be automatically applied to the SubA and
SubB subfolders (provided, however, there is no access rights set individually for them). But, if you set the Read
and Write access rights for the SubB subfolder, you will be able to edit data even if its parent folder has the Read
Only access level.

Therefore, the access level for a group of users for every folder/record is determined:

• By the folder itself, if access levels are evidently set using the Access Level menu;
• By the parent folder, if the access rights are not specified for the current folder itself;
• By the access rights set for the user who has logged into the database, if the folder is a root folder.

However, if the user who has logged into the database has the rights of Administrator, he or she has unrestricted
access to all folders and records, regardless of the access rights set for separate database elements.

36
ACCESS LEVELS FOR DB ELEMENTS
You can set different access level for user groups for the following elements of the database:

• Folders and Records - right-click an object and select the Set Access Levels... menu item. It is possible to
specify the groups of users that will have writing rights, and groups that will have reading and writing
rights.
• Form Fields - open the Forms Editor and select a necessary field. At the top of the window in the
properties of the element select the Edit and Visibility item. On the displayed tab select the Only For
Groups... value from the list for the Visible or Editable property.
• :

Now, clicking the Set Groups button, you can specify the groups of users for which this field will be
visible/accessible for editing. Note: prohibition to edit fields for some groups does not apply if the value of
the field is changed from the script.

• Toolbar Buttons - in Toolbar Editor select any button and select the Show this button only for the
selected groups” check box. This will allow you to make the button (or menu) on the toolbar available
only for specific groups.
• Timers - in Database Timers select any timer and select the Run only for the groups check box. Now the
timer will be executed only for the specified groups of users.

USERS AND SCRIPTS


When creating scripts you can use the system variable [$_User Name] to get the name of the user who has called
the script.

For example, if we want to log the changes of database records, we can apply the Apply Text Formula to a field
action for the on change event of a text field. The parameters will be the following:

In this case, when the text box is modified, the following information will be added in the log field:

2006-06-23 12:01:45 John


2006-06-23 15:45:10 Tom
2006-07-02 13:02:34 Mary

In this example John, Tom and Mary are names of users who modified this record.

To learn more, see the Scripts and Text Formulas sections.

37
NETWORK TROUBLESHOOTING
Errors at connecting to the remote database (Client)

At connecting, the message "Remote Database was not found" is displayed.

This message means that the program has not get an answer to the request to connect to the database. Possible
reasons:

• The database is not opened on the remote computer. The database should be opened and shared.
• The database is not shared on the remote computer (closed for external access). To share the database,
select File > Share Database... from the menu.
• The IP address of the remote database is specified not correctly. At sharing the database on the server, the
IP address of the computer on which it is located (for example, 192.168.0.2) appears in the caption. Check
the correspondence of this IP address to the one that is specified in the connection window. Depending on
the settings of your network, this address can change. To learn more, contact your Network Administrator.
• The port over which the connection is accomplished is specified not correctly. By default, the database is
shared over port 6420, but you can specify any other port to be used. In case the ports specified at database
sharing and at connecting do not coincide, the connection will not be accomplished. Check the ports
correspondence.
• The set firewall blocks connection. Make sure the Brilliant Database program is listed in the 'Trusted
Applications' section in the firewall settings.

At connecting, the message "The server version of the software is different from your version" is displayed.

In case of work over the network, the versions of programs installed on the server and client computers should
coincide. To learn the exact number of the version (build), select Help > About... from the menu. The build number
is specified at the upper right corner in gray and starts with the # character (for example, #0536).

To correct this error, install one version of the program on all computers working with the same database over the
network (for example, download it from our site).

At connecting, the message "The license (registration key) you are using doesn't allow you..." is displayed.

This error can occur if the number of users/computers working with the database exceeds the number permissible by
your license. For example, if you have purchased the license for using the program on 3 computers, you will not be
able to work with the same database from 4 computers. To work on another computer with the database, you should
purchase an additional license.

To learn on how many computers the registration key allows you to work, see the 'About' window (select Help >
About... from the menu).

Errors at database sharing (Server)

There can be two errors:

• The set firewall blocks connection. Make sure the Brilliant Database program is listed in the 'Trusted
Applications' section in the firewall settings.
• One Brilliant Database is already shared on your computer. To share another database on the same
computer, specify another port (by default, port 6420 is used; you can specify, for example, port 6421).

38
ADB SERVER MONITOR
ADB Server Monitor is a small application that allows to automatically:

• Run Brilliant Database;


• Open a specified database and login into it;
• Share this database over network;
• Monitor the database status, alert and restart it in case of freezes (hangs).

You can run it from the "File->Share Database..." windows of Brilliant Database:

ADB Server Monitor Interface

The top part of the software window contains information about the opened database. In case the database doesnt
reply for more than 2 seconds (freeze) it will change to:

If the database freezes for more than 5 seconds (by default), the montor will alert with a sound and restart the
database.

Configuration Tab

On this tab you can specify an application and a database to monitor. To edit this data you should stop montoring,
by clicking the "Stop monitoring" button.

Log File

39
This tab contains a list with all important events.

Timeouts

This tab allows you to setup timeout values for different operation. In case an operation takes more time than
specified, the monitor will alert about it and restart the monitored application.

Options

This tab allows you to turn on/off a sound alert and specify any executable application or an URL that will be
opened in case of database crashes or hangs.

40
QUERIES
Queries allow retrieving records that match specified rules from the database, displaying them in a specific way and
performing defined actions for them.

A query is a user's request for information to be retrieved from a database. A query consists of the following parts:

1. Specification of records source for analyzing rules conformity;


2. Set of rules, according to which the records/queries will be checked for consistency;
3. Specification of how the request results should be displayed.

As an example, let us examine, using databases, what queries contain information about books. Assume that we
have the following information about every book: Title, Author, Number of pages, Publication date, and Year of
purchase. In this case, a query would be a formal description of such expressions as follows:

Example 1. I want to get from the database a list of books written in 1995, sorted by name. Where:

• "from the database" is a source;


• "written in 1995" is a rule;
• "a list of books, sorted by name" is a specification of how the results should be displayed.

Example 2. I want to get from the My Favorite Books folder a list of the books published in the year of creation,
the number of pages of which is greater than 200, grouped by author, where:

• "from the "My Favorite Books" folder" is a source;


• "published in the year of creation, the number of pages of which is greater than 200" is a ruleset;
• "grouped by author" is a specification of how the results should be displayed.

Example of displaying query results:

Queries can also be used to change records and create Recordset variables.

41
QUERY EDITOR
To create/modify/delete queries you should use Query Editor.

To open the Query Editor window, select the Queries > Add/Modify/Delete Query... menu item in the main
menu:

Query Editor

The Query Editor window consists of two panes:

• The left pane provides the list of queries available in the database, and the buttons to add and delete a
query. The queries are grouped by types of records, the current record is marked with the blue color;
• In the right pane you can edit the current query.

Creating and Deleting Queries

• To create a new query, click the New Query button in the left upper part of the window and select the
record type, with which the new query will work. By default, a query returning all records of the selected
type is created. To modify a query, use the right pane of the window;
• To delete the current query, click the Delete Query button in the left upper part of the window.

Modifying the Current Query

The right part of the windowis used to edit the selected query. It contains 4 tabs: Query, Appearance, Actions and
Misc.

Query Tab

The contents of this tab can be divided into three parts:

• Part 1 - the records source (i.e., the folder, from which the records should be taken);

42
• Part 2 - set of rules, according to which the records and the queries will be checked for consistency;
• Part 3 - in this part you can specify fields the records should be sorted by. Using unique field you can
specify the field that has to be unique in the query results. For example (for a database of books), to get a
list of all genres, indicate genre as distinct. Now the query will return only one book for each genre, and we
will get a list of all genres. Otherwise the resulting list will contain all books and, consequently, duplicating
genres.

When creating a new query, the set of rules is empty. This means that all records from the specified folder (and its
subfolders, if the corresponding check box is selected) will be returned.

At the left of the window there are 3 buttons that can be used to create, delete or edit rules. If a ruleset contains more
than one rule, you should use the And/Or button to specify whether a record to be returned should satisfy all the
rules (and), or one of the rules (or). For example:

• Get a list of the books published in 2000, and those the number of pages of which is greater than 100;
• Get a list of the books, which were either published in 2000, or the number of pages of which is greater
than 100;

You can also use bracket "(" and ")" to create complex rules.

Clicking either Edit Rule or New Rule opens the window for rule editing, where you can set up the rule.

Appearance Tab

• Table Style - click this button to define how query results are to be output (fields, colors, grouping,
subtotals, etc.) Learn more...
• Show query results in - this option defines where query results are to be displayed:
o Small List - query results are to be displayed in a special window to the left, under the folder list;
o Main Table - query results will be displayed where the record list normally appears; at the same
time, the record list in the current folder will be hidden.
o When the check box is cleared, the window with query results will not be displayed.
• Configure totals - this button opens the window in which you can specify the fields by which it is
necessary to display the sum, minimum and maximum value in the query results. In the report it will look
in the following way:

• Add Toolbar, Toolbar... - select this check box to add a toolbar that will be displayed over the query
results. For example, there you can place buttons for printing results or for mass editing of selected records:

• Show the 'Refresh' button - select this check box to display the Refresh button over the query results. On
clicking this button, the query will be executed once again (updated).

43
Actions Tab

• Restart query... If none of the records meets query parameters, the user will be offered to repeat the
request with different parameters. This option is performed only if any parameters in the ruleset are
specified as "variable" (see above).
• Automatically select the first record from query results. After a request is accomplished, the first record
in the query results will be selected.
• Print query results. After a request is accomplished, you will be offered to print out its results.
• Export query results using an export/send template. After a request is accomplished, you will be offered
to export its results by using Export/Send templatesexport to txt, send records by e-mail, etc). Learn more...
• Execute a script for each record. If this check box is selected, the specified script will be executed for
every record in the query results in turn. For example, if you include in the script the line incrementing the
field value by 1, the field value of all records in the query results will be changed.
• Execute a script one time after the query is complete. In contrast to the previous script, this script will
be executed only once, no matter how many records are in the query results. You can, for example, display
a message about the query execution, offer the user to print records from the query and so on.
• Execute a script before running a query. In this script you can init data for the query or ask user for a
confirmation. You can also cancel the query execution from this script. To do it set the [$cancel] variable
to "1".

Misc Tab

• Don't show the query in the "Queries" menu - select this check box to hide the option for execution of
the query in the queries menu.
• Don't show the "no records were found" message - select this check box if you do not want the program
to show the message in case no records have been found.
• Limit number of records - this option allows you to specify the maximum number of records returned by
the query.

44
CHARTS
CREATING CHARTS
To add a chart to the database:

1. Select Add > Special > Chart... from the menu.


2. Specify the source of records for the chart. These can be records from a specific folder, as well as records
from a query. The chart will be created using the records data.
3. After that, the Chart Configuration window will be opened:

4. In this window on the 'Type' tab, specify the chart type (bars, line, pie and so on).
5. On the second tab 'Datasets' it is required to specify correct values for the three key fields:

o Argument field - specify a field that will be the argument (usually defined horizontally). For
example, if you want to get the average level of sales for goods, select the 'Name of Goods' field
as the argument; if you want to get a chart of changing the average cost of goods in time, select
the 'Order Date' field as the argument.
Note: If the argument field has the 'Data' type, the program will offer to pass to the 'date chart'. In
contrast to a usual chart, the date chart has a possibility to group records by days, weeks, months
and provides fields to choose the time interval.
o Value field - specify a field from which it is necessary to get data that should be displayed on the
chart (numeric value, usually defined vertically). For example, for a chart displaying changes of
the average order price in time, the value is the 'order cost'.
o Value operation - define how to group values with the same argument. Possible values: sum,
average, min, max. For example, for the chart displaying levels of sales by goods, it is necessary
to specify 'sum', and for the chart displaying changes of the average order price in time - 'average'.
6. If you need to display several charts on one list (for example, to compare sales of two groups of goods),
you should add an additional set of data by clicking the 'New' button on the Datasets tab and specifying an
additional source of data and fields for it. Records from a dataset can be filtered by clicking the 'Filter'
button.
An example of a chart with 2 datasets:

7. Specify other parameters of the chart - colors, axes, legend and so on.

45
CHART TYPES
You can select the chart type on the first tab of the Chart configuration window:

There are 9 types of charts available.

Vertical Bars

Data is displayed as vertical columns located one by one. For every dataset you can specify its
own form: Square, Cylinder, Diamond, Cross, Polygon, Star.

Vertical Bars (Stack)

Data is displayed as vertical columns; at that, the values from different datasets with one
argument are summed up and grouped.

For example, this can be used to display the total level of sales but at that specify different
products in it.

If only one dataset is specified, the chart does not differ from a usual "Vertical Bars" chart.

The form of columns is defined by the form of columns of the first dataset.

Vertical Bars (Percentage)

This chart can be used to display percentage of data from two or more datasets. The range of
the vertical axis values is between 0 and 100%.

This can be used, for example, to display the percentage of the sales level for different groups
of products.

The form of columns is defined by the form of columns of the first dataset.

Horizontal Bars

This chart is the same as Vertical Bars, but the columns are located horizontally. For every
dataset you can specify its form: Square, Cylinder, Diamond, Cross, Polygon, Star.

46
Lines

Data is presented as lines.

Beside a color for every line, you can specify:

• Type (Solid, Dash, Dot, Dash-Dot) - only for 2D charts.


• Line weight - only for 2D charts.

• Character - Square, Diamond, Circle, Cross - is set at the key points of a chart.

Area

Data is presented as filled areas.

In this type of a chart it is recommended to use transparency so that different datasets do not
overlap each other.

Area (Stack)

Data is presented as filled areas located one above another (values from different
datasets are summed up).

If you set 100% transparency for the lower dataset, you can get a chart with a
'hovering area'.

Area (Percentage)

This chart is used to display percentage of data from 2 or more datasets. The range of values
for the vertical axis is from 0 to 100%.

Pie

Pie chart. The only chart type for which only one dataset can be displayed.

47
CHART PROPERTIES
The Chart configuration window comprises a number of tabs that can differ depending on the selected type of a
chart:

In the right part of the window there is a chart preview area.

Type Tab

On this tab, beside the chart type (bars, pie, lines and so on), you can specify the main chart parameters.

• Enable 3D - if this check box is selected, the chart will be presented in three dimensions, for example:

• Date/Time based chart - select this check box if the chart displays change of values depending on time
(that is, the argument field is of the date type). For example, if it is a monthly sales chart or chart displaying
distribution of calls between the week days. At that, the Date Interval tab and additional possibilities will
become available.

Datasets

One chart can have a number of different datasets. For example, in the picture below there are 3 datasets (red,
yellow and blue):

Every dataset can use different records and fields. For example, you can create a chart comparing levels of sales and
paid taxes by months.

Depending on the chart type, the values from different datasets with the same argument can be displayed differently
or can be summed up (stack charts), or can be displayed in percentage (percentage charts):

To create a new dataset, click the New button.

48
Dataset properties

• Dataset name - name, displayed in the legend (in case there is any);
• Data source - determines the data source for the dataset. There are 3 possible data sources:
o records from a specific folder;
o records returned by a query;
o records stored in a recordset variable;
• Filter - filter for records. For example, if we want to compare the sales level for 2 products, we specify the
same data source for 2 datasets but set up different filters, for example: "[Product]=Prod_A" and
"[Product]=Prod_B".
• Argument field - specify a field that will be the argument (usually defined horizontally). For example, if
you want to get the average level of sales for goods, select the 'Name of Goods' field as the argument; if
you want to get a chart of changing the average cost of goods in time, select the 'Order Date' field as the
argument.
Note: If the argument field has the 'Data' type, the program will offer to pass to the 'date chart'. In contrast
to a usual chart, the date chart has a possibility to group records by days, weeks, months and provides fields
to choose the time interval.
• Value field - specify a field from which it is necessary to get data that should be displayed on the chart
(numeric value, usually defined vertically). For example, for a chart displaying changes of the average
order price in time, the value is the 'order cost'.
• Value operation - define how to group values with the same argument. Possible values: sum, average, min,
max. For example, for the chart displaying levels of sales by goods, it is necessary to specify 'sum', and for
the chart displaying changes of the average order price in time - 'average'.
• Color - allows you to define the dataset color and its transparency. This option is ignored for pie charts.

Availability of other dataset properties depends on the chart type (for example, the weight of lines or the column
form).

Legend

The legend is a list of datasets displayed on the chart, with their color definition.

On this tab, you can specify the position, font and colors of the legend. For example, in the picture below the legend
is at the upper part of the chart:

Axis X/Axis Y

This tab allows you to set up the appearance of axes:

• Display/hide an axis;
• Add/delete the axis label;
• Change the color, font and the font angle for the axis label;
• Change the output format for values. Learn more about the values format...

Chart Area

This tab allows you to set up the appearance of the chart area:

• Chart background.
• Presence of the grid on the chart, and the grid color.

49
• Presence and the format of labels to the datasets elements. Labels are displayed separately for every value:

The label can contain the percentage/absolute expression value, the argument name or any other text. Learn
more...

Date Interval

This tab is available only if the 'Date/Time Based Chart' check box is selected on the 'Type' tab.

Using this tab, you can specify how to define the range of dates displayed on the chart:

• Automatically - automatically displays the latest N dates. At that, you should specify an interval of
grouping (day, month, year, week day). For example, if the number of intervals is equal to 12, and monthly
grouping is selected, the data for the last 12 months will be displayed.
• Manually - the user can define the range of dates him-/herself. To perform this, the control panel will
appear above the chart.

Pie Options

This tab is available only if the chart type is pie:

The tab allows you to:

• Select the size, font angle, material (solid/glass) and background for the pie:
• Specify the format, appearance and the position of labels to the parts of the pie chart:

Sorting

This tab is not available if the chart type is 'Date/Time Based'.

• Order By - sorting order. You can sort by the argument value, as well as by the value of one of the
datasets.
• Max # of values - defines the maximum number of values displayed on the chart. At that, all other values
will be summed up and specified as defined in the Name all other as field. For example:

In the first picture, the number of values is not limited (all 7 values are displayed).
In the second picture, the number of values is limited to 5, therefore the last 2 values ("AUD=17" and
"RUB=10") are united into the "Other" value which equals 27 (10+17).

50
FORMATTING LABELS FOR CHARTS
Introduction

You can set formatting of labels in charts for:

• Value axis (usually, the vertical axis)


• Values in charts
• Labels of pie chart parts

The format is defined by the formatting string. For example, ${value} will produce values with the '$' character at
the beginning (for instance, $10, $12, $14 and so on).

The word in braces is called a tag. You can use several tags at the same time, for example: ${value}, {percent}% or
{value|2} EUR, {gpercent}%.

The number inside the tag after the '|' character defines the number of digits after the comma.

Tags description

• {value} - displays the numeric value of the element (what is usually indicated on the vertical axis):

This is the only tag that can be used on the value axis.
• {percent} - outputs the percentage of the displayed value to the sum of all values for the specified
argument:

• {gpercent} - outputs the percentage of the displayed value to the sum of all values for the whole chart:

• {xlabel} - outputs the argument name:

51
CALENDARS
Calendars in Brilliant Database are used for displaying usual records as events on a calendar:

At that, start and end time of an event is taken from the record fields. If a record is moved on the calendar, the
corresponding fields of the record are changed. And, vice versa, if the user changes the field with the event date in
the record, event block will be moved on the calendar.

You can select one of four types of displaying events on the calendar:

• Day
• Work week
• Full week
• Month

There can be several independent calendars in the database. Created calendars are displayed in the tree of folders:

52
CREATING CALENDARS
To add a calendar to the database:

1. Select Add > Special > Calendar... from the menu.


2. Specify the source of records for the calendar. These can be records from a specific folder, as well as
records from a query. Record data will be displayed on the calendar as events. The records form should
have at least one field of the 'date' type to be able to display them on the calendar.
3. After that the Configuration calendar window will be opened:

4. In this window on the 'Calendar Data' tab, it is necessary to specify what fields contain date and time of the
event start/end.
o It is necessary to specify only one field with the start date of the event.
o If the field with the end date of the event is not specified or coincides with the start date, the event
will be regarded as a one-day event.
o If the start/end time of the event is not specified, it is regarded that the event takes the whole day
(or several days).
5. Set up other calendar parameters - color of events, behaviour and so on.
6. Click the Apply or Ok button to confirm changes.
7. If you have specified everything correctly, the calendar of the following type will appear on the screen:

53
CALENDAR PROPERTIES
As the calendar represents a special folder in the database, all its properties are united with the folder properties.
Therefore, to specify calendar settings, right-click the calendar folder and select the Folder Properties... or
Calendar Properties... item from the displayed Folder menu.

The calendar properties window will appear on the screen:

The window contains 2 tabs common for all folders and 3 tabs for setting up the calendar properties themselves:
Calendar Data, View and Behaviour.

Calendar Data Tab

On this tab, you can specify the source of the records that should be displayed on the calendar, and fields containing
start/end dates and time of events. To learn more, see the Creating Calendars section.

View Tab

To describe this tab, let us study a part of the calendar:

• Subject Field - field from which the heading of the event is taken. The heading is specified in bold font on
the calendar events (Meeting, Discuss Soft B, Presentation).
• Body Text Formula - Text Formula on the basis of which the description of the event will be generated. In
our example only one field - "[Location]" - is specified as a text formula. Therefore, we see the value of
this field on the calendar (Office A, Office B).
• Set Dynamic Colors... - allows you to specify different colors for events depending on the content of the
records (in the picture - green, red and blue). Learn more about color rules...
• Default view - allows you to specify the calendar scale on its opening:
o Day
o Work week
o Full week
o Month
• Show Date Picker - in case this option is enabled, a regular calendar with several months for fast passing
to a necessary date will be displayed on the right of the events calendar.
• Time Scale - step of the time scale (thin horizontal lines in the picture). When events are moved on the
calendar, the values of the fields storing start/end time of the event will be changed at the specified step.

54
For example, if the step of the time scale is 30 minutes, the event can be moved at 12:00, 12:30, 13:00 and
so on, but not at 12:15 or 12:42.

Behaviour Tab

On this tab, the behaviour of the calendar and possible user actions are described:

Notes:

• To create a new record using the calendar (the Allow to create new records check box should be selected),
double-click on any blank area of the calendar. At that, a new record with the pre-set start/end time and
date of the event will be created. You can also create a long-term event by selecting any area on the
calendar and right-clicking it.
• The On record change (drag) script is called for a record after the user has moved the event on the
calendar or changed its start/end time. In this script you can, for example, specify to update the field with
duration of the event or send a notification on the event moving.

55
DATABASE MAINTENANCE
DATABASE OPTIMIZATION
Database optimization is a process at which data inside a database file is reallocated and united in order to fasten
work of the database. This process is equivalent to the process of defragmentation of hard disks.

To perform optimization, select File > Database Maintenance from the menu.

There are two buttons on the 'Optimization' tab:

• Analyze - scans the database to check if optimization is needed. At that, blue area determines data that does
not need optimization, and yellow and red - fragmented data that needs to be optimized.
• Optimize - performs database optimization.

BACKUP
Brilliant Database has its own system for creating backup copies, as well as a possibility to create backups using
scripts.

To open the Database Properties window, select File > Database Maintenance from the menu and click the second
tab:

Backup Options

Hot Backup

This type of data protection works in the following way:

• When the database is opened, its copy is created in the same folder where the database is located;

56
• The name of the copy file consists of the original name of the database and the number of the copy (for
example, "1~MyDB.bbd");
• When the user finishes working with the database and closes it, this copy is deleted;
• If in the process of work the program is closed not correctly (in case of a critical error, blackout and so on),
the copy remains. Therefore, if data was corrupted in case of malfunction, you can restore the previous
state of your database from this copy.

Default Backup

Usually backup is performed every N minutes. Created backup copies are not deleted. By default, backup copies are
stored in the same folder where the database is located; but you can select to store them to another folder by
selecting the Special folder for backup check box.

The name of a copy consists of the database name and a timestamp. For example, name MyDB2009-02-18_16-
44.bbd means that the copy was created on February 18, 2009 at 16:44.

The minimum time interval between creation of 2 backup copies is 2 minutes.

DATABASE STATUS
To open the 'Database Status' window, select File > Database Status... from the menu.

This window contains the following tabs:

• System Log - this tab displays a list of non-critical mistakes that occurred at execution of scripts, work by
the networks and so on.
• Connected Clients - in case the program is a server, this tab will contain a list of remote users working
with the database.
• Failed Emails - this tab contains a list of e-mails that have not been sent to the user over the SNMP
protocol for some reasons (for example, if there was no connection with the server). These e-mails can be
re-sent or deleted. Learn more about sending e-mails from the program...

57
INTEGRATION
This section contains information about integration of Brilliant Database with other programs, formats, e-mail and
Internet. To know how to create addons please, review the Creating Addons and Advanced Integration section.

IMPORT/EXPORT TO ACCESS, EXCEL, ETC.


This section describes how to import or export records to/from an existing Access, Excel or Lotus database. You can
also work with data in databases using scripts. Learn more....

Importing From 3rd Part Databases (Access, Excel, Lotus)

Using Brilliant Database you can import (export) data from databases of the following types:

Microsoft Access *.mdb


Microsoft Excel *.xls
1-2-3 WKS Lotus WK1 *.wks
1-2-3 WK1 Lotus WK1 *.wk1
1-2-3 WK3 Lotus WK3 *.wk3
1-2-3 WK4 Lotus WK4 *.wk4

Select the File > Import/Parse > Import From Access/Excel menu item to open the import dialog:

For correct data import the following data should be specified: the database and the table to import records from (1-
2), the folder and the record type to import records to (3) and the fields to import (4):

1. To select the database you want to import records from, click the Browse button (...) in the Import From pane.

2. In the drop down list of the Import From pane select the table to import records from.

3. In the Import To pane select the folder to import records to and the Record Type for the imported records.

4. In the Fields to Import pane set associations between the fields of the imported table and database fields by
double clicking the field to import.

To start import, click the Import button.

Advanced

On the Advanced tab you can set advanced import parameters:

58
Exporting To 3rd Part Databases (Access, Excel, Lotus)

To open the export dialog window, select the File > Export/Send > Export To Access/Excel menu item.

Records configuration and export into another database is performed similar to the import procedure.

Besides usual data export, using field correspondence, it is possible to change cells in another database with the help
of a script during the export. Learn about exporting...

Presets

If you import (export) records frequently, the configuration of the data transfer (e.g., a path to the database, relation
between the database fields, etc.) can be saved as a Preset. To work with presets, click the corresponding button in
the bottom left part of the window:

• Save... - used to save the current settings for import/export as a preset;


• Load... - used to open an existing preset;
• Delete Presets... - used to delete one or several presets.

Using Presets and Script Designer, you can completely automate the import/export process and perform it with one
click.

59
EXPORT TO WORD, HTML/SEND MAIL
Using Brilliant Database you can perform the following operations of text export:
• Send an e-mail
• Create a web-page
• Copy to Ms Word
• Copy to clipboard
• Export to text file (txt, csv, xml)

To perform exporting, you should create a template using the corresponding Export/Send Template Editor and call it
from the File->Export/Send menu:

IMPORT AND PARSE WEB, MAIL, WORD, ETC


Using Brilliant Database you can perform importing and parsing of text (distribution by fields of the database,
copying into variables and so on).

You can use the following text sources:

• Web-page
• Text file (txt, csv, etc)
• Ms Word document (doc, rtf)
• Mails from Outlook
• Drag-and-drop data (any text dragged to the program window)

To perform importing, you should create a template using Parser Template Designer and call it from the File >
Import/Parse menu:

60
SYNCHRONIZATION
The synchronization allows you to move or update records, forms, reports and other elements from another database
of similar type. For example, you can update reports in an old database or import records created in another
database.

To import data from other databases (Excel, Access, etc.), you should use the Import from 3rd part DB.

Synchronization Wizard

Select File > Import/Export > Synchronize with another DB to open the synchronization window:

1. First you should specify the database from which the data will be imported. To do it, click the "..." button. Note:
you can import data only if the database version coincides with the version of the program.

2. After that, the buttons for importing different database elements will be available.

Click the Other... button to update all queries, report styles, user functions and so in the current database at once.

To save relations in the imported records, don't click the Finish button before you import all the relational records.

If it is necessary to perform the same synchronization for several databases or simplify the process of
synchronization for another user, you may create a file for automatic updating on the basis of performed
synchronization.

Import/Update

If the current database already contains a form similar to the form you are importing, the program will offer you to
update it instead of importing:

When updating is over, the imported form will replace the current form. If the fields in the current form don't
coincide with the fields in the imported form, data loss may occur.

61
EXAMPLE OF SYNCHRONIZATION
Suppose you have created a database for contacts registration and installed it on your partners' computers. Let's call
the partners' database partner.bbd and yours - main.bbd

Part 1. Updating \ Adding Forms, Reports, etc.

Let's imagine that after some period of time the created database does not meet your partner's needs anymore, so
they have asked to add several additional fields to it (for example, the web-page and photo fields). You have added
the mentioned fields to your database, checked its functionality and now you need to update your partners'
databases, preserving the information they have already entered into the database. In other words, you have your
database (main.bbd) with updated forms and partners' database (partner.bbd) with an old contact form.

Updating procedure will be as following:

1. Run the software.


2. Open the database you need to correct forms at - partner.bbd.
3. In the menu select File > Import/Export > Synchronize with another DB.
4. In the displayed window choose the database with the updated forms - main.bbd
5. A window will pop up, offering you to create a backup copy. Click OK and create a backup in case of
synchronization errors.
6. After that, synchronization buttons will be available:

7. You need to update the form. To do that, click the Forms... button and choose the form you need to update.
The software will warn you that the form already exists in the database, and will offer to either update it or
import the form as a new one. Choose the Update option:

8. The software will give you a warning with the list of fields to be updated, added or deleted:

9. Click Yes.
10. The form is updated. If you need to update or import other database elements that store no data (i.e., are not
records), use corresponding buttons (Timers, Custom Export, etc.) and repeat steps 6-9. If you need to
update all reports and queries, click the Other... button and choose an appropriate menu item.
11. Click the Finish button to get back to work with the database.

If there are a number of partners (database users) or a lot of database elements that need to be synchronized, it is
advisable to create a file for automatic updating. By means of such file the user will be able to update the database
quickly and easily with just one click, not resorting to the synchronization dialog. Learn more...

Part 2. Adding Records from Another Database

You have decided to look through all the contacts your partners created in their databases, as well as through your
own records. For your own convenience, you will have to combine all databases into one. The easiest way to do it is
to import the information from partners' databases (partner.bbd) into yours (main.bbd):

1. Run the software.


2. Open the database you wish to add records to: main.bbd.
3. In the menu select File > Import/Export > Synchronize with another DB.

62
4. In the displayed window choose the database with imported records - partner.bbd.
5. A window will pop up, offering you to create a backup copy. Click OK and create a backup in case of
synchronization errors.
6. After that, synchronization buttons will be available:

7. You need to import the records. To do that, click the Records... button and choose the folder, records from
which you wish to import. If the entry form in the opened database is different from the imported database,
the software will not be able to import the records and you will see the following message:

To bring the forms to identical state, please use the instruction described in Part 1.
8. If everything is all right, in the folder tree you shall see a new folder that will store all imported records:

9. If the records you need to import are stored in different folders, repeat steps 7-8 for every folder you wish
to import those records from.
10. If the records you are importing are connected with each other by relational fields, all the bonds will be
restored once you are done with importing and click the Finish button. Note: in order to keep relational
bonds, you will have to import all the connected records at once. If you click the Finish button during the
process of adding the bounded records and then reopen the same database to continue importing the
records, the bonds will not be saved.
11. Click the Finish button to get back to work with the database.

63
UPDATING DATABASES
The present section describes how to create and use a file for automatic updating of a created database.

What can it be done for? If the developer of a database and its user is the same person, everything is easy in case
there appears a necessity to make some changes in the database structure — for example, to add a field or a report.
The developer opens a work database and adds necessary elements there.

And what if a database is complicated, and its structure is developed by one person (you) and is used by another one
(the user) or even many people worldwide? Each of them has his or her own records in the database. At some
moment of time the existing structure stops suiting users and they decide to add some fields, reports and replace
used formulas. In this case, there are several variants of solution for this task:

• To ask users to send their databases, make necessary changes and send databases back. However, if there
are a lot of users or they store some confidential data, it will be very difficult to fulfill this task.
• Make changes in your own database and send it to all other users with an instruction to perform
Synchronization. This way is more convenient, however, if in this case it is necessary to update many
components of the database (forms, reports, functions and so on), the user may make a mistake and update
wrong components.
• Create and send a file for updating. At that, for updating the user will just have to open this file, and all
necessary changes will be introduced in his or her database. Let's have a closer look at this way of
updating.

Practically, updating is synchronization plus a script of updating that describes what elements of the database and in
what way should be updated. Do not be afraid — you will not have to write a script for updating; it is created
automatically on the basis of any performed synchronization.

Creating a file for automatic updating

To create a file for automatic updating, you will need two databases:

• The first one (let's call it current_db) — contains the current version of the database that we are planning
to update, installed on the users' computers;
• The second one (let's call it new_db) — a new version with changes, to which you need update users'
databases.

To create a file for automatic updating:

1. Open current_db.
2. Select File->Import/Export->Synchronization.
3. As the second database, select new_db.
4. Perform synchronization to update the structure of current_db to new_db (import forms, reports, update
scripts and so on — do whatever you need). For more information, see the Synchronization section.
5. On completing synchronization, click the "Save this synchronization as an update file..." button at the
bottom of the synchronization window.
6. The window with settings for an update file will be opened. On the first tab, enter the headline of an
update. It will be displayed to the user before the update is executed. On the second tab you can see what
database components will be updated (that is, a list of actions performed at synchronization).
7. Click the "Save..." button and specify under what name a file for automatic updating should be saved.

That's it. Now send this file to all users, and they will be able to perform updating of their databases to a new
version automatically — by selecting it in the File->Update Database... menu.

Recording databases versions

64
Thus, in the paragraph above we have described how you can create a file for automatic updating for your users.
However, the database changes, and it is necessary to update the database structure once again. Then one more time.
It is good if all users are well-disciplined, but what can be done if some users perform the second update without the
first one? For example, in the first update a form was added, and in the second update a report for a new form was
added. At best the user will get an error message and at worst (if updates are more complicated) — the structure of
the database may be corrupted. Though before every update a backup copy of the database is created, there may
occur an unpleasant situation.

This question is solved by such parameter as version available for every database. For a new database a version is
absent (there is an empty line).

Changing and recording versions is set in the update settings:

• Flag 1. If this flag is selected, the update file can be used only for databases having a specific version (let's
call it version_from).
• Flag 2. If this flag is selected, after execution of an update a new version will be assigned to the database
(the version name is specified lower, let's call it version_to).

To avoid mistakes at updates, we strongly recommend selecting both flags and specifying both values.

At updating the database for the first time it is necessary to leave version_from empty, and in version_to specify, for
example, "ver2". After execution of the update the database version will become equal to "ver2". At updating the
database for the second time it is necessary to specify "ver2" in version_from, and in version_to, for example,
"ver3".

When trying to run the second update for a database having any version other than "ver2", the user will get a
notification on version mismatch, and the update will not be performed.

You can specify any names of versions you like, for example, upd_2008-04-20 or fix_a.

If an update is not a compulsory one and does not make critical changes in the database structure (for example, adds
new records to a database), it is possible to disable setting of a new version (version_to).

In any case, you should seriously treat the question of keeping records on database versions if you have several
users and are planning to support their databases, adding new options to them and modifying them in
correspondence with users' requests.

Current version of a database is shown in the main window caption, in brackets:

65
DATABASE DESIGN
This section describes tools that can be used to create a database.

FORM DESIGNER
The Form editor is a key editor in Brilliant Database. Using it, you can create new forms (types of records) and edit
existing ones.

ABOUT FORMS
Forms determine the type of records we want to work with. For example, in case of a library database, there will be
two forms: book and author. In case of a company database, we will need correspondingly such forms as product,
order, employee and so on.

Therefore, the notion of "Form" is a synonym of the "Record Type". If we compare Brilliant Database with such
database as Access, we can say that, creating a new form in the database, we create a new table.

Let us review the "Author" form as an example. It consists of the following elements.

• 1. One or several tabs (Basic Info, Comments, History)


• 2. Simple fields for storing data. In this example, "Author Name" is a text field, "Birthday" is a field for
storing dates.
• 3. Relational fields for relating to other forms. In this example, this is the "Books" field storing a list of
books written by the author. Data for this field is taken from the records of the "Book" type.
• 4. Mathematical fields. They do not store any data, but display the results of calculations by specified
formulas. In this example, these are the total number of books in the "Books" field and the sum of all pages
written by the author.
• 5. Fields for storing images and files. In this example, it is the "Image" field in which the author's photo is
stored.
• 6. Control buttons (New Book and Print). Buttons can perform simple actions as well as complicated
scripts.
• 7. Labels to fields.

A form can have a fixed or alterable size. The form with the alterable size will stretch when the program window is
changed, allowing you to use the working space at most, for example:

66
As you can see, the form consisting of two text fields stretched when the size of the program window was changed.
To learn more about alterable forms, see the Layout section.

Forms themselves do not store data; to this end, you should create records on the basis of created forms. To learn
more, see the Database Basics section.

FORM DESIGNER
The Form Designer is a key tool in database creation. It allows creating new forms and editing already existing
ones. To access it, as well as other database editors, use the Design DB menu:

The Form Designer window consists of four panes:

1. List of Forms

This list contains all forms available in the database and is used to select the current form for editing.

2. Editing Area

The Editor area is used to select elements and change their size and positioning. Click an element to select it. The
selected element is highlighted with eight squares around it:

Drag one of the black squares to change the element size. Drag the mouse while holding the left button down to
select multiple elements (the same way you select files in Windows):

Properties of the selected element are displayed at the upper part of the window.

67
3. Properties of the Selected Element

Properties of all elements are distributed over 8 tabs. 7 tabs are the same for all types of elements (Fonts, Scripts,
Colors, Visibility and so on), and the content of the "Individual Properties" tab changes depending on the type of
selected object. For example, in the picture above the properties of the form itself are displayed.

Short description of properties:

• Font/Color/Border - allows you to modify common properties of the elements, such as font or color.
• Tab Order - this group sets the tab order, that is, the sequence of input focus switched with the Tab key.
• Layout (for elements) - this group sets the element behavior when the size of a form changes.
• Layout (for forms) - this group sets the form position in the database window.
• Sheet (for elements) - this group allows you to define on which sheets of the form this element will be
displayed.
• Sheets (for forms) - this group allows is used to add a new sheet to a form, delete an existing sheet or set
its properties.
• Scripts and Behaviour - on this tab you can change elements behaviour on different user actions (on
mouse click, on changing the value, etc.), or assign scripts.
• Edit and Visibility - on this tab you can determine conditions, in which the element shall be shown in the
form, and conditions, in which the user will be able to change its value.

4. Toolbars

Using toolbars, you can perform the following actions:

• Creating and deleting forms;


• Changing order in the list of forms;
• Editing fields;
• Creating new fields.

68
MANAGING FORMS
The simplest way to create and delete forms is to use buttons at the upper left corner on the Form Designer:

Creating New Forms

To create a new form:

1. Open Form Designer;


2. Select Forms->Create New Form... from the menu.
3. A master of new forms will be displayed:

From a list of templates, select the form that you need. If there is no appropriate form, use the "Blank"
form.
4. Click Next and pass to the second tab:

Here:
o Form Name. We recommend that you use a noun in the singular for the name of a form. For
example, the form for storing information on books may be called "Book", and the form for
storing information on orders - "Order". As a result, when the form is mentioned in the process of
work with the database, you will see correct messages, for example: "Create New Book" or "Are
you sure to delete selected Books?"
o Create a Folder.... Select this check box if you want to create a new folder in the database that
will be used for all records with this form as a default folder. That is, all new records will be
created in this folder, this folder will be used as a source at creation of queries and so on. At that,
you can always move a record to another folder or select another folder as a source for a query.
o Add relation.... This option allows you to quickly relate this form to any other form. At that, on
the new form and the form that was selected for relation, necessary relational fields will be
automatically created. You can create relations between forms manually, simply adding
corresponding relational fields onto ready forms.
5. Click the Finish button. A new form will be created and will appear in the list of forms.

You can also create a new form by cloning an already existing one (Forms->Clone Form...)

Deleting Forms

To delete a form:

1. Open Form Designer.


2. Select the form you want to delete.

69
3. Select Forms->Delete Form from the menu.
4. Confirm deletion.

Note: Before deleting a form, you should delete all records using this form from the database.

Forms order

In case there are a lot of forms in the database, you can change their order: for example, sort them alphabetically or
by importance. The order of forms does not influence the work of the database but is used in the dialogs for
choosing a form. For example, in the Add main menu for adding a record:

To move the current form in the list, use two right buttons on the Form Designer panel:

FORM PROPERTIES
To access the form properties:

1. Open Form Designer.


2. Select a necessary form.
3. At the upper part of Form Designer, the window with form properties will be displayed.

Form Editor is the starting point of database creation in this application. With Form Editor, you can not only change
the visual representation of the form, but also choose the fields to be used for data storage, change their properties
and positioning. A single database may incorporate several forms, e.g., to store information on commodity, clients,
staff and so on. Also, each form may include some sheets.

Select the Designer > Edit Form menu item to open the form editor window.

Individual Properties

• Form Name. We recommend that you use a noun in the singular for the name of a form. For example, the
form for storing information on books may be called "Book", and the form for storing information on
orders - "Order". As a result, when the form is mentioned in the process of work with the database, you will
see correct messages, for example: "Create New Book" or "Are you sure to delete selected Books?"
• Icon. Icon for a form is used in tables, lists and so on to quickly identify the form.
• Default Folder. If a default folder is specified for the form, it will be used in the following cases:
o At creation of records using the Add menu.
o At creation of new queries with this form.
o At creation of relational fields to connect to the form, as a source folder of records.

70
We recommend you to select the folder that is mostly frequently used to work with records of this form as a
default folder.

• Title Field. Field from which the heading of a record will be taken. This heading will be used when records
are displayed as a simple list, in different dialogs and so on. For example, for the "Order" form you can
specify the order number as the "Title Field"; for the "Book" form - the book name.

Font/Color/Border

This tab allows you to customize the appearance of the form.

Layout

On this tab, you can specify the behaviour of the main window size:

• Corner - form will be located at the corner of the window:

• Center - form will be located in the center of the window:

• Fit to window - form will be stretched as the window size changes:

To learn more about the stretching forms, see the Form Layout section.

Tab Order

On this tab, you can define the field focus change using the "Tab" key. This order will be used in different menus
and lists (for example, at selecting the field by which sorting should be accomplished).

Popup menu

71
On this tab, you can create custom menu items for the "Record" menu. This menu is showed when you right-click
on a form or on selected records in a record's list:

Clicking a menu item will execute a script for the selected records.

To create a new menu item click the green button "+". To edit a script associated with the selected menu item, click
the "Edit Script..." button.

Sheets

This tab can be used to control tabs of the form itself. For example, the following form has three tabs:

For every field you can select a tab on which it should be displayed (or you can select to display a field on all tabs).

Scripts and Behaviour

On this tab, you can define scripts for form events. More information about this you can find in the "Events and
Predifined Variables" chapter.

72
FIELDS

Fields Basics, Creating and Deleting


Fields are main elements of the form.

Creating New Fields

Use the Add Elements Toolbars to add new elements:

To add an element to a form:

1. First click the corresponding toolbar button;


2. Click anywhere on the white space of the form;
3. Depending on the type of element, you may be asked to enter main element parameters, for example, define
a script for a button.
4. Enter the name of the element.

Deleting Fields

To delete one or several elements on the form:

1. Select it (or them) on the form.


2. Click the "Delete" button ( ) .

Important: When a field is deleted, you will lose all data stored in this field. However, the data will be removed
from the database not at once, but little by little in the process of work with the database. For example, if you delete
a field for storing images, all images available in the database will become inaccessible, though will not be removed
from the database. To remove old data stored in non-existing fields from the database, use "Database Optimization".

73
Common Properties of Fields
Introduction

This section describes properties of fields common for all types of fields. The window with field properties is
located at the top part of the program window and has 9 tabs:

1. Individual Properties - properties specific for different types of fields.


2. Font/Color/Border - allows you to modify common properties of the elements, such as font or color.
3. Layout - this tab sets the element behavior when the size of a form changes.
4. Sheets - this tab allows you to define on which sheets of the form this element will be displayed.
5. Tab Order - this group sets the tab order, that is, the sequence of input focus switched with the Tab key.
6. Pop-up Text - on this tab you can specify a text that will be popupped if you hold the mouse cursor on a
field. For a form this option is replaced with "Pop-up menu" that allows to create custom menu items in the
standard "Record" popup menu.
7. Scripts and Behaviour on this tab you can change elements behaviour on different user actions (on mouse
click, on changing the value, etc.), or assign scripts.
8. Edit and Visibility - on this tab you can determine conditions, in which the element shall be shown in the
form, and conditions, in which the user will be able to change its value.
9. System - on this tab you set mandatory and unique fileld properties.

Layout

This property is used only when the position property of a form is set to fit to window. When this option is
selected, changing the application window size makes the form resize to fit the window. You have to set the
behavior for all of elements of the form using the Layout properties pane. The following figure shows a sample
element layout schema.

The light-blue field represents the element, while the texts on its sides allow setting the layout options for the
following element properties: width and height; left, right, top and bottom margins. If the FIXED option is set for
some property, this property remains unchanged regardless of the form size. On the other hand, setting the float
option for some property makes the property value vary according to the form size. Please note that you cannot set
all three position properties (vertical or horizontal extent and margins) to FIXED.

For example, let us consider how the width property of the element affects its extent having the left margin fixed
and the right margin floating, when the size of the form changes.

Case A illustrates the element clipped due to the form size reduction. Case B shows that the element resized
according to the form size has changed: shrank to the form size reduction and increased to the form size extension.

According to the layout rules, the left margin has not changed while the right margin varied in all cases.

74
Combining elements with various positioning properties in a single form allows gaining the optimal use of the form
surface, regardless of the window size. You may consider sample layouts in the example file.

Scripts and Behaviour

On this tab you can change elements behaviour on different user actions (on mouse click, on changing the value,
etc.), or assign scripts.

Actions can vary depending on the type of fields, but usually you can specify the reaction of the element to the
following action:

• On edit - script performed at manual editing of the field value. The script will not be performed if the field
value was changed from the script, for example, using the "Apply Text Formula to a Field" action.
• On left button click - action performed at clicking the field.
• On right button click - action performed at right-clicking the field.
• On double click - action performed at double-clicking the field.
• On "Enter" key - action performed at pressing the "Enter" key when the field is active (only for simple
text fields).

More information about events you can find in the "Events and Predifined Variables" chapter.

Scripts selected for these events can be called from other scripts using the "Execute field's script" action.

Edit and Visibility

On this tab you can determine conditions, in which the element shall be shown in the form, and conditions, in which
the user will be able to change its value:

For Visible/Editable you can define the following values:

• Yes - field is always visible


• No - field is always hidden
• By Rule - additionally, by clicking the "Set rule..." button, it is necessary to set a condition that should be
met for the field to become visible. For example, you can display the field only if a specific value is entered
into another field.
• Only For Groups - display only for specific user groups. You can select groups by clicking the "Set
groups..." buttons.

75
System

• Mandatory:
o No - the field is not required to be filled.
o Yes - the field is required to be filled. A record can not be saved if the field is empty.
o Show Warning - the field is required to be filled. However, a record can be saved after
confirming a warning message.
• Unique:
o No - any value can be entered into this field.
o Yes, for a folder - only a value unique for the record's folder can be entered in this field.
o Yes, for the DB - only a value unique for the database can be entered in this field. Please note, the
software will scan the whole database to check the uniqueness and it can take a time.

If the System Field check box is selected for the field:

• This field will never be used in simple search for all fields;
• This field will be inaccessible for selecting from the "Folder->Table View->Columns..." menu (the list of
columns that should be displayed in the table). At that, if this field is marked as visible in the Table Style
Editor, a usual user will not be able to hide it in the table.
• It will not be possible to manually sort records by this field.

We recommend you to hide and mark as system those fields, values of which are not intended for changing and
viewing by the user (for example, results of intermediate calculations, history of work with the record and so on).

76
Basic Fields

1. Single-line text field


2. Password field
3. Numerical field
4. Mathematical field
5. Date/time fields

1. Drop-down list
2. Multiline text field
3. Flag field
4. Multiselet field
5. ID field

1. E-mail Field
2. URL Field

Single-line text field

This element is used to store single line text.

Individual Properties

• Mask - this property allows you to specify the format of entered text. For example, if you specify the "###-
XX" mask, the user will have to enter three digits, then a dash and two letters: 123-GH, 645-AB and so on.
Special characters for specifying the mask:
o # - defines any digit (1234567890)
o X - defines any letter (ABCDEF...)
o ? - defines any character

Password Field

This field is used to store single line text, all characters are shown as "*" characters.

Note: At viewing field values in the table, the values will be displayed as is. Therefore, it is recommended to mark
these fields as "system" (on the Edit and Visibility tab) so that the user cannot select it for viewing in the table.

Numerical Field

This Field is used to store numerals. The range of numbers for storing is from -1E+100 to +1E+100

Individual Properties

• Format - format for displaying numbers by default. For example, number 1200.5 can be displayed as
"1'200,5" or "$1 200.50". Learn more about the numbers formatting...

77
Mathematical Field

This field is intended for accomplishing calculations for database fields. For example, if the form has the "Price"
and "Quantity" fields, you can create a mathematical field "Total" and specify the following formula for it:
[Total]=[Price]*[Quantity]. [Total]=[Price]*[Quantity]. The formula is set with the help of Formula editor.

Individual Properties

• Format - format for displaying calculations. For example, number 1200.5 can be displayed as "1'200,5" or
"$1 200.50". Learn more about the numbers formatting...,
• Type - defines how to store a formula:
o Static - specified formula is stores in the form properties and is used for all records. That is, all
records created with this form will use the same formula, and if the formula is changed, the
changes will be reflected in already created records. This type of storing formulas does not extend
the database size and is optimal for the speed of values calculation.
o Dynamic - formula can be specified separately for every record. The formula is stored in the
record itself and can be changed at work with the database. The formula that is specified in the
Form editor, will be used only for newly created records. This type of storing formulas extends the
database size when a new record is added, even if all formulas are the same.
• Formula - formula for calculating itself. The formula is specified with the help of the Formula editor.

Date/Time Fields

These fields are used for storing date and time.

Individual Properties

• Format - format for displaying field values. Learn more about formatting dates and time...
• Initialize the field with the current system date/time - if this check box is selected, at creation of a new
record, the current date and time will be recorded into this field.

Drop-down list (combobox)

A drop-down list allows you to select one value from the list:

There are 3 types of drop-down lists.

Simple drop-down list. Allows to select a value from a simple pre-entered list of values.

List based on other list. Allows to select a value from a list based on the selected value of other list. For example if
a form has a "Country" list, you can create a "City" list based on the "Country" list and enter a list of cities for each
country.

You can enter separate lists for each value or one big list. In this case you should enter it in the following format:

::USA::
New York
Washington
Chicago
::Russia::
Moscow
Novgorod

78
Colons are used to specify values from the parent list.

List based on records

In this case a list of values is generated on records from a specified folder or a query. You can also use a simple-
relational field to solve this task. However, there is a little difference in these methods. E.g. there are an "Item" and a
"Location" forms. We want to be able to select a location for an Item from the list of locations in our database. We
can use both a drop-down list or a simple relational field to solve this task. Lets image the name of one location is
changed. What will we see on Item records that are using this location?

• Drop-down list: The field will still show us the old value, because it stores a value, not a link to a record.
• Relational field: The field will show us the new (actual) value, because it stores a link to a record, not a
value.

Multiline Text

This field is used for simple multiline text.

Individual Properties

• Max text length - limitation for the text length in characters


• Spell Check - this menu allows you to enable spell checking for the entered text. To learn more, see the
"Working with multiline text field" section.

Flag Field

The flag can take two values: 1 and empty.

Individual Properties

• Flag at right - when selected, the label to the check box will be displayed on the right of the check box.

Multiselect Field

The multiselect field allows you to select several values from the list:

Individual Properties

• List - list of possible values.

ID Field

At creation of a record, a number from the counter is entered into this field, and after that, the counter is
incremented by 1. That is, we get records with values 1, 2, 3 and so on.

Individual Properties

• Current ID - current value of the counter.

79
E-mail Field

This field is used to store e-mail addresses. The only difference from a simple text field is that when this field is
clicked, the e-mail client will be opened, offering you to create an e-mail with the specified e-mail address.

Brilliant Database can create and send e-mails on its own. To learn more, see the Send/Export Templates section.

URL Field

This field is used to store URLs. The only difference from a simple text field is that when this field is clicked, the
web page by the specified URL will be opened (for example, "http://www.google.com" or "http://www.some-
company-site.com").

Static Fields
These fields are not intended for storing data.

1. Label
2. Button
3. Text-button
4. Shape
5. Static image

Label

Label is used to display static text information, such as field captions.

Button

The buttons are used to automate various operations with the database (e.g., a button that creates a new record or
increases the field value by one). To define the script to be executed by the button, use Script Designer. To check the
operability of the button, close Form Designer and click it.

Individual Properties

• Icon - icon displayed on the button;


• On Button Click - script that will be executed on pressing the button;
• Hide Caption - if this check box is selected, only icon without a label will be displayed on the button:

80
Text Button

This field looks as a simple text field, though it works as a button. That is, you can enter any text in the field, then
you press "Enter", and the script defined for this field will be executed. For example, this can be searching records
by the entered text, adding the entered text to the hidden field and so on.

Individual Properties

• On text enter - script that should be executed when the "Enter" key is pressed.
• Type - in what way the specified value should be passed to the script:
o Send value to a first dialog - outdated variant, is used for compatibility with previous versions.
The entered value will be passed to the first displayed dialog for entering data. View example...
o Set the [$input] variable - entered value will be copied to the [$input] variable that can be used
in the script.

Shape

This item allows adding simple geometric figures to the form for grouping other items.

Individual Properties

• Shape - element form (round, oval, square, rectangle, rounded rectangle)


• Border width.

Static Image

This item is used for displaying an image on the form.

Individual Properties

• Picture - displayed image.

81
Image, File, Richtext Fields
These three fields are united into one section as they store so called "binary" data of substantial volume:

• Image Field - is intended for storing and displaying images.


• File Field - is intended for storing file attachments.
• Richtext Field - is intended for storing formatted text (for example, this text can contain images,
highlighting with colors, in bold and so on).

Image Field
This field is intended for storing and displaying images. An image added to this field is stored directly in the
database file. The field looks in the following way:

You can add an image to the field in one of the following ways:
• From a simple image file (jpeg, bmp, gif, etc)
• Directly from the scanner or a web-cam
• From the Clipboard
• Using scripts, the "Image/File field operation" action
Individual Properties of the Image Field
• Image Layout - defines the way in which the image should be displayed:
• Stretched - image is stretched by the field size (as displayed in the picture above)
• Normal - image is displayed without scaling, as is. For example, if the image is larger than the
field, the image will be cropped.

• Image Import Properties - when this button is clicked, the window will be opened, where the user can
specify actions to be performed for the image at its adding to the database.

For every action, there are three variants possible: Ask - the user is offered to perform the given action
when the image is added to the field; Always - the action is always performed and Never - the action is
never performed.
• Convert to low-size JPG Format. For the time being, the JPEG format is optimal for storing
photos and takes little space.
• Scale Large Images. For this action, it is necessary to additionally specify the maximum possible
size of the image in pixels. If the size of the image added to the database is larger than selected, the
size will be decreased to the specified one. For example, if the set maximum size is 600 pixels and
the imported photo is 2816x2112 (6Mpx), it will be reduced to the size of 600x450, and for the
size of occupied space from ~1.5Mbytes to ~300Kbytes.

82
File Field

This field is intended for storing any files.

Individual Properties of the File Field

• Limit by type - this parameter defines the type of files that can be stored in the field. By default, you can
store any types of files. A permissible type of files is specified in the following way: Type_Title|
Ext1;Ext2;Ext3.... For example, to allow the user to store archives in the field, you should enter a line:
Archives|*.zip;*.rar. Therefore, the user will be able to select only files with the .zip and .rar extensions,
and in the "Open File" dialog window the "Archives" type of files will be displayed. To store Microsoft
Word documents, enter Ms Word Documents (doc)|*.doc.

Richtext Field

This field is intended for entering and storing formatted text:

Individual Properties of the Richtext Field

• Text toolbar position - defines the position of the panel for text formatting. Three variants are possible:
o Next to the field (as shown in the picture).
o In the window caption (for example, in Microsoft Word or other programs for work with text).
o Not displayed at all. At that, there will remain a possibility of formatting using hot keys.
• Toolbar buttons - determines the appearance of the panel:
o Full with all buttons and options (font, color, alignment, paragraph).
o Short only with main elements (font and color).

You can find a full description of the formatting panel in the Working with Richtext Fields section.

83
RELATIONAL FIELDS

About Relations
Let us use a simple example to explain what relations and relational database are.

Let's imagine we have a client database. There is one type of records (form) - "Client" in which we store client's
name, phone number and the company address:

In some time we notice that we have a lot of clients from the same companies. That is, we have to enter the
company's address for every client anew. In addition, if the company moves, we will have to change the company's
address for all clients who work in it. We face three problems:

• Necessity to re-enter information that we have already specified


• Excess data (the same name is stored several times)
• Difficulties at changing records

To fix this problem, we have to move our simple database to the relational model. How can we do that?

1. Create a new type of records (form) - "Company" with two simple fields: Title and Address.
2. Create records of the "Company" type with information on companies in the database. Now we have a list
of companies:

3. Open the "Client" form and add a simple relational field named "Company" onto it. A relational field does
not store text or numbers within; it stores a link to another record or records of a specific type. In our case,
we will specify a link to the record about a company in this field. Therefore, a folder with records about
companies will be the source for this field.
4. For all clients, specify corresponding companies in this field.
5. Remove from the "Client" form unnecessary fields "Company Title" and "Company Address".
6. The relational database is ready.

Therefore, the client form will look as follows:

To choose a company for a client, there will be a convenient list of companies:

84
However, now we cannot see the company address on the form with information about a client. We can fix it using
the relational lookup field. This field displays the value of the record field that was selected in the relational field.
That is, in our case, we will be able to see the company address:

So, we have created what is called single one-way relation:

• Single - as only one company corresponds to one client.


• One-way - as we have a client-company relation, but we do not have a company-client relation. That is,
defining that a client works in the company does not influence the company in any way. Having selected a
company, we cannot view all clients who work in it (of course, you can always create a query or
accomplish search to do this).

To create many-to-many relations, you should use a many-to-many relational field. It looks like a table and can
store links to several records at once. For example, we can add such field to the "Client" form to display a list of his
or her friends:

That is, we have created a many-to-many multiple relation with records of the same type. Many-to-many means
that, if we add the record "Mary" to the "Friends" field for "John", the record "John" will be added for "Mary" as
well:

A common example of a many-to-many relations is the library database. Every book can have several authors, and
one author can have a number of books:

85
Planning relational database
Before you create a relational database, it is recommended to consider all relations between forms that you want to
create. For example, the structure of the database for keeping records on sales for a small store may look as follows:

Here:

• The name of the form is specified in bold (Client, Order, Item, Product)
• Relational fields are specified in blue.
• Relations are marked with arrows. Two-way arrows are used for many-to-many relations.

In the database this will look in the following way:

86
Many-to-many Relational Field
With the help of Many-to-Many Relational Fields you can create relations between recordsets. What does it
mean? For example, you want to create a database of books. To do this, you would need to create two types of
records, i.e., Book and Author. Since each book may be written by several authors, and each writer may be the
author of several books, you would need to set a conformity between the recordsets of the Author type and of the
Book type.

Below is a graphical illustration of this process:

According to these relations, the user can affirm that:

• Author 1 wrote Book A;


• Author 2 wrote Books A and B;
• Author 3 wrote Book B and C.

Or, in a different way:

• Book A was written by Authors 1 and 2;


• Book B was written by Authors 2 and 3;
• Book C was written by Author 3;

Establishing such relations allows you to get the answers to the following questions:

• Which books did this particular author write?


• How many books are written by this author?
• Who are the authors of this particular book?
• You will also be able to answer such "exotic" questions as: "What is the average number of pages in the
books of this author?"

In exactly the same way, you can connect more than two types of records, such as Products, Customers and
Orders.

87
Step-By-Step Many-to-Many Relational Database Creation

This section contains a detailed instruction of how to create the Books and Authors database described above.

1. Switch to the Form Editor mode.

2. Create the Book form and then place the following elements on it (see the Form Editor section):

• Book Name - text field;


• Pages - numerical;
• Cost - numerical.

It is also recommended to give some space for the many-to-many relational field Authors.

3. Create the Author form and place the following elements on it:

• Author Name - text field;


• Books - many-to-many relational field;
• Books Number - mathematical field;
• Total Page - mathematical field;
• Average Pages/Book - mathematical field.

When creating the Books field, the program will ask you:

• To which type of records the specified type of records will be related? Select Author.
• Which fields of the records should be displayed? Specify all existing fields (Book Name, Pages, Cost),
and then set their width and position, in the way it is shown on the picture above. To learn more, see the
Table Style Editor help section.

Use the following formulas to extract data from a relational field when creating mathematical fields:

• mmrMathOp(|Books|,|Pages|,|Sum|) - to calculate the number of pages written by a particular author;


• mmrMathOp(|Books|,|Pages|,|SimpleAverage|) - to calculate the simple average number of all pages from
all books;
• mmrRecN(|Books|) - to calculate the number of books written by a particular author.
• more...

4. After that, return to the Book form, and add the Authors field, specifying the Book form as a source:

88
Nothing depends on order in which the relational fields are created. Moreover, information about connections
between records is stored in the record itself, not in the relational field. I.e. If a relational field is deleted, the
connection between records does not disappear.

Working with the Many-to-Many Field

After the forms are created, close Form Editor and switch back to the database mode.

There are two ways to connect two records (add a record to a relational field):

• Double-click the table heading in the relational field;


• Right-click many-to-many relational field, and then select Add Item... in the menu:

Accordingly, to delete a connection between 2 records, you should right-click the record in the relational field, and
then select the Remove selected item menu item:

As stated above, relations between the records are equivalent, which means that it does not matter either you add
authors to a book description, or you add books to an author description, the result will be exactly the same. The
same way is also appropriate for deleting relations.

The contents of the many-to-many fields can be changed by using scripts. View example.

Many-to-Many Relational Field Properties

• Source Folder - folder from which the user can select records for the relational field.
• Relational Set - see below;
• One-way Relation - if this check box is selected, a one-way relation will be created. That is, in the
example with Author-Book, if we add a book to the Author, the Author will not appear for the Book. One-
way many-to-many relational fields work faster than usual, as in this case, it is not necessary to make
changes in the created record.
• Configure Appearence - allows you to customize the appearance of the table using the Table Style Editor
in which all related records are displayed.
• Records Input Config - allows you to customize the appearance of the window for selecting records for a
relational field. Learn more...

89
What is Relational Set?

For example, you want to distinguish between two types of authors for a book: the major authors and minor authors.
For this purpose you will need two many-to-many fields in the book form. One of the fields will store the major
authors, while the other field will store minor authors.

To make each of these fields independent of each other, you have to define different Relational Sets for them. This
can be done on the Individual Properties tab of the field.

By default Relation Sets have standard names Primary, Secondary, etc, but for convenience we will rename them
into Major Authors and Minor Authors.

Now the relations structure will look as follows:

Now, when you work with the many-to-many field, you will have an additional option at your disposal:

Move selected to - this action moves records from one mmr field into another. In our case using this action you can
move an author from the Major Authors field into Minor Authors, and vice versa.

90
Simple Relational Field
Simple Relational Field allows to use in the record the data taken from other records. For example, you have such
records as Client type, and such ones as Order type. In the Order record it will be convenient to create a Relational
Field which will contain the link to the record about the client. Thus, the list of clients will be the source for the
Order record.

The field has the following parameters:

• Source folder - a folder from which the data for the current field will be chosen by default (in the case it
can be the Clients List folder);
• Field to show - the source record field which will be displayed in the Relational Field (in the case it can be
Client Name or Client).
• Records Input Config - allows you to customize the appearance of the window for selecting records for a
relational field. Learn more...

Relational Lookup Field

This field is used only together with the Simple Relational Field or Many-to-Many Field, and is used to display
the source record(s) fields. For example, if you have a simple relational field, in which a client is selected, we can
use the Relational Lookup Fields to display the client's age and address fields:

The field has the following parameters:

• Source Relational Field - Relational Field (one or many) used as a source for this field, Field (in the case
mentioned above it is the field created above, containing the link to the client);
• Field To Show - the source record field which will be displayed in the Relational Lookup Field. This
parameter is completely similar to the Field To Show parameter for the Relational Field, presented above.
If a many-to-many field is selected as the source, the values will be separated by comma (",").

91
Link To Folder Field
The Link To Folder field allows the user to keep a link to any folder in the database.
For example, in the following picture, a field with a link to "Project A Files" folder is displayed.

At clicking this field, you will pass to the folder (if it is specified) or open a dialog window for browsing to a folder.
To change or delete a link to a folder, right-click the field.
You can use a link to the record in scripts, having created a variable using the "Set Var By Folder Field" method.

Link to Folder Field Individual Properties


• Top Level Folder - the folder from which it should be possible to select other folders for the field. By
default, the root folder is selected, that is, the user can select all folders:

If, for example, "Photos" folder is set as the Top Level Folder, the window for selecting a folder will look
as follows:

Using Link to Folder Field

Before reading this section, it is recommended to get acquainted with the section dedicated to scripting.

The Link To Folder field allows the user to keep a link to any folder in the database. Let's take a closer look at this
option.

1. Create a new database and, using Form Editor, create the Project form with two fields: a simple text field
named Project Title and the Link to Folder field named Project Folder:

2. Create the Projects folder with the Project record in it. Click the Project Folder field and create a new
folder; name it Project A Files in the folder selection dialog. Select this folder:

92
Now every time clicking the Project Folder field, you will be automatically transferred to the Project A
Files folder, where you can save records on the project.

Using "Link to Folder" field in formulas

What if we want to know how many records belong to this project without looking into this folder every time? Or
perhaps we need to know the total amount of expenses on this project? In such cases use Mathematical Field.

1. Open Form Editor and add a Mathematical Field named Records Count and containing the following
formula:

As you see, as the folder for the formula, which returns the number of records, the value of the Project
Folder field is used. Save the formula and return to the database.
2. Now this form shows the number of records in the selected folder:

Using "Link to Folder" field in scripts

Now let's create a button on the form to add notes to the selected folder automatically.

1. Open Form Editor and create a form named Note. It should have two simple fields - Note Title and Note
Text:

2. Go back to the Project form and add a button with the following script on it:

In the first line of the script we copy the value of the Project Folder field into the [$folder] variable. In the
second line we create the Note record in the folder of the specified variable. Record creation occurs within
a pop-up screen.
3. Name this button New Note. The form should look like this:

Every time you click the button, a new record form will pop up, and a record will be created in the field set by
Project Folder.

To create more complicated record relations (for example project - person responsible - notes), use relational fields.

93
REPORT STYLE EDITOR
Report Styles determine in what way records should be printed. For example, the same records about people can be
printed as a table, Envelopes, Business Cards, Photos.

Creation of a Report Style is similar to creation of a form - we also add different elements onto the Report Style,
such as database fields, labels, graphs, page numbers and so on. The way we locate these elements on the Report
Style determines the way records will look at printing. For example:

• Fields are located one next to another, one record for one line - and we get a table:

• Records are printed as forms:

• Records are printed as forms, in three columns:

94
REPORT AREAS

It is a common practice that a report is divided into several areas. This


software presumes that a report consists of the following areas:

Header is printed at the top of each page and usually contains the company
name and logo.

Title is printed on the first page only, right next to the header, and usually
contains the report name. The title area can also be used as a title page (to
learn more, see the Records Layout section).

Sub-Header is printed on each page, right after the title or the header.
Basically, it is used to print table headers.

Records represents the data areas and forms the body of a report. The
number of data areas is defined by the number of records used to form the
report. Each data area represents only one record. Records can also be
displayed in several columns and grouped.

Summary is printed after all record data areas. It usually contains


information based on records included into the report (number of records,
number of pages, average cost, etc.)

Footer is printed at the bottom of each page and usually contains the page
number and the printout date.

95
REPORT STYLE EDITOR INTERFACE
To open Report Style Editor, use the Designer >Edit Report Styles... menu item. You can also open Report Style
Editor directly from the preview window:

This method is more preferable as it allows you to see right away how the report being edited will look like when
printed.

The Report Style main window is visually divided into 4 parts:

1 - List of existing report styles. Use the list to select a report style for editing.

2 - Area Editor Pane. Use this window to modify areas and elements properties (positions, sizes, colors, fonts,
etc.).

3 - Toolbars. Contains the report style management toolbar, the edit toolbar and the set of elements.

4 - The selected element properties windows.

Creating and Deleting Report Styles

Use the first panel to manage report styles:

Buttons description (from left to right):

• Create. Use the button to create a new report style. You can create a blank report style or use a wizard.
• Clone. Use the button to clone the selected report style.
• Delete. Use the button to delete the selected report style.
• Move the report style in the list (Up/Down). Use the button to change the report style position in the
report style list (1).
• Modify Properties. Use this button to configure report style properties (such as name, number of columns,
records layout, printer, etc). Learn more about report style properties...

96
Editing Area

Click a necessary area of the selected report style to select it. The selected area is marked with color, while the other
areas remain black-and-white:

You can select elements in the same way as you select an object in Windows. To select a single element, use the left
mouse button. To select multiple elements, move the mouse while holding the left mouse button down. The selected
element is marked with eight blue handles on its sides and corners of the element. In case of multiple selection, the
first property tab changes to Arrange and contains element alignment tools.

You can move elements in the same way you move an object in Windows, i.e., using the drag-and-drop technique.

You can adjust the grid spacing and measurement units by selecting the Tools > Options... menu item.

To copy/cut/paste/delete elements use the edit toolbar:

Legend

Depending on the type of element, special characters can be displayed next to it on this tab:

• *w* - means that the width of the element is automatically re-sized when its contents changes;
• *h* - means that the height of the element is automatically re-sized when its contents changes;
• red arrow - means that location of the element depends on the location and size of another element;
• ABS POS: X, Y Cm - means that the element will be printed on the page with a strict indent of X cm
(inches) from the left margin and Y cm (inches) from the top margin.

To learn more, see the Positioning of Report Style Elements section.

If the element is marked with a blue border, this means that it is a database field or a formula; if the element is
marked with a gray border, this means that it is a simple static label.

Creating Elements

Every report area consists of elements. To add a new element to the area, click its icon on the element panel:

The element will appear in the current area. Learn more about elements...

97
REPORT STYLE PROPERTIES
To access the Report Style Properties window, press the Ctrl+P key combination or use the Report Style > Modify
Properties menu item.

This window has 3 tabs: General, Records Layout and Paper, Printer, Margins.

General
This tab contains general report style properties.

• Report style name - this field defines the style name. This name will be used for selecting the report style
before printing.
• Use this report style "by default" to print... - if this option is enabled, this report will be used by default
for printing records of this type.
• Don't allow to select this style from the preview list - if this check box is selected, you will be able to use
this style at printing only if the "Print Records" action is used in the script and this style is specified there
explicitly.

Group and Sort


This tab allows setting up report sorting and records grouping.

Group records by

This option allows selecting the field by which records will be grouped.

The view of the Record Area in Report Style Editor will change, as it will have additional areas for the group name
and for the group sub-total:

• All information above the first blue line (place sub-group header here) will be printed only if the
previous and the current records have different values in the field selected for grouping. In this case, when
orders are returned, this field will contain the client name (Client).
• All information below the second blue line (place sub-total here) will be printed only if the subsequent
and the current records have different values in the field selected for grouping. In this case, when orders are
returned, this field will contain the amount of orders for each client.

To calculate the sub-total for a group, use Formula Editor and functions subMathOp and subRecN.

98
At printing, this report will look as follows:

If the "Print each group on a new page" check box is selected, in our example we will get two pages instead of
one - one for "John Tompson", the other one for "Sid Forest".

Note: activating grouping does not imply that records will be sorted by the selected field. If you don't want to carry
out sorting every time before printing, set it up in the report properties (see below).

Sort before printing

When this option is selected, records will be sorted in the order you have indicated. If they were sorted before (for
example, by means of a query), the previous sorting order will be lost .

Records Layout
On this tab you can define how the records will be located on the sheet.

• Use the 'report title' area as a title page. - if this option is enabled, a title page will be added to the report.
That is, the first page of the report will contain only the content of the 'report title' area.
• Print only one record on each page. - if this option is enabled, each page will contain only one record,
otherwise the program will automatically break records into pages due to the columns settings.

99
Columns
With the program you can print columns in two different modes: top to bottom and from left to right:

Printing from left to right is available only if the records to be printed are of the same vertical size. As a rule, records
being printed are of different sizes if the record area comprises elements with the Fit height to text size property.

If you select printing from top to bottom, records may have a different size. Also, if a record does not fit on one
page, it will be automatically split into several records (see the picutre).

Top to bottom printing is recommended when you print large texts (for example, letters), or when printing into a
table. Left to right printing is preferable for data of a fixed size, for example, business cards or images.

Paper and Printer Tab


On this tab you can select and set up the printer that will be used for printing the current report.

• Get Information - click this button to get information about the printer that will be used for printing the
report.
• Configure Printer and Paper - click this button to select the printer to print the report. For each report
you can select a separate printer and individual printing properties. For example, invoices can by default be
printed on a laser printer, annual reports - on a color bubble-jet printer, and letters on special paper. Also,
you can set up the printer right before printing by clicking the Printer... button in the Print Preview...
window.
• Margins - in this window you can specify the margins from paper edges when printing. The margins are
not displayed for editing the report in Report Style Editor, but they can be viewed during the print preview.
The measuring units can be changed in the Report Stlye Editor Properties window (Tools > Options or
Ctrl+O).

100
COMMON PROPERTIES OF REPORT STYLE ELEMENTS
Properties of the elements are grouped into five sheets.

Individual

This sheet varies depending on the type of the edited field. Read more...

Text Style

This tab allows setting the following visual properties of the text style:

• Text Alignment;
• Font;
• Line Spacing;
• Text Color.

Background

This tab is used to assign a frame, a background color or an image to the selected element. The following parameters
may be set:

• Background Color;
• Background Picture;
• Background Picture Scale and Position.

Lines (Border)

This tab is used to assign borders (lines for shapes) to the selected element. The following parameters may be set:

• Border Width;
• Border Color;
• Border Parts.

101
POSITIONING OF REPORT STYLE ELEMENTS
The element location is defined on two tabs: Position and Margins.

This tab is used to set the element behavior when the size of its contents changes, as well as the element positioning:

• Bring To Front, Send To Back - defines whether the element overlaps the other ones or other elements
overlap it.
• Auto-size Width/Height - if this check box is selected, the element will be resized automatically when the
size of its contents changes.
• Snap Horizontal/Vertical Position to... - makes the distance between the two elements constant,
regardless of any changes in their sizes.
• Absolute position on a page... - defines the precise position of the element when it's printed out. The
position is measured from the top left corner of the sheet. The position will be fixed and won't change
depending of the number of records, the size of the print area, etc. The position of an element on paper
doesn't depend on its position in the area when you edit the report.

The following figure shows an example of the area with the Auto-size and Snap Position to... properties.

Below is the printout view of the area:

In this example, the Item Name and Location elements change their sizes automatically, the is located field is
docked to the Item Name field, whereas the Location field is docked to the is located field. The following figure
displays the same area without docking:

Obviously, is located does not change its position and overlaps the titles in three cases. If we disable the auto-size
feature, the text will be cut off according to the element length:

The same rules are applied when setting the vertical position and the size of the element.

102
REPORT STYLE ELEMENTS
• Database Field is used to print the value of the record field. The main parameter of this field is the
name of the record field that contains the value to print.

• Formula Field is used to print the processed report data (total product cost, product year fall of price,
average age, etc.). The main parameter of this field is a formula used to calculate the field value. For
example, we know the product quantity and its price. The formula to calculate the total consignment cost
will be as follows: [Cost]*[Quantity]. The formula to calculate the average consignment cost will be as
follows: repMathOp(|Cost|,|SimpleAverage|). For more information see the Formula Editor section .

• Chart is used to print charts (vertical/horizontal bars, pie charts). To create a chart, specify the field to
be used as its argument (for example, time, the name of a town or a person) and the fields to be used as the
source of its values (for example, sales volume, population, height and weight of a person). Learn more
about charts...

• Static Text/Image/Shape. Decoration elements that are the same at printing, regardless what
records are printed.

• Time/Date. At printing, this field displays the current date/time (that is, the time of printing).

• Page/Record Numbers. This field displays the page number, number of records in the report, the
number of records per page and so on.

• User Input. This element displays text that any user can change in the preview window before printing.

• Text Formula. Displays text by the specified Text Formula.

103
Database Field
Database Field is used to print the value of the record field. For example, if we want to print records as a table,
we have to create a number of database fields on the report and locate them one next to another in the "Record Data"
area:

In this case, these are two fields displaying values of fields of the printed "Title" and "Room Type" records.

If such Report Style of three records is used, the report will look in the following way at printing:

Properties

• Source Field - what field should be printed.


• Source Record - field of what record should be printed. Possible values:
o Default - field of the current printed record (see the picture above). It can be used in the "Record
Data" area only.
o Fixed Record - field of any record selected from the database. For example, if in the database
there is a record storing information about the database creator and we want to display this data in
the header of the report, we can create the "Database Field" in the report header, where we can
define this record as a "Source Record".
o From Recordset - similar to "Fixed Record", but instead of selecting a record, we define a
recordset variable, from which a record is taken at printing. That is, to use this option, we need to
start printing from the script, that should first initialize the recordset variable, and then call
printing, for example:

Formula Field
Formula Field is used to print the processed report data (total product cost, product year fall of price, average
age, etc.). The main parameter of this field is a formula used to calculate the field value.

For example, we know the product quantity and its price. The formula to calculate the total consignment cost will be
as follows:

[Cost]*[Quantity].

The formula to calculate the average consignment cost will be as follows:

repMathOp(|Cost|,|SimpleAverage|).

Properties

• Formula - formula by which the value should be calculated.

For more information, see the Formula Editor section.

104
Static Label, Shape, Image Elements
Static Text

This element is used to add static texts on the report style (table header, company name, comments, etc.). The
content of the static information does not depend on the data to be printed and remains constant. The main parameter
of this element is the text. Static Text elements may be created on areas of any type.

Static Image

This element is used to add static images on the report style (e.g., company logo). The content of the static
information does not depend on the data to be printed and remains constant. The main parameter of this element is
the picture. Static Image elements may be created on areas of any type.

Static Shape

This element is used to add static shapes on the report style (lines, stars, etc.). The content of the static information
does not depend on the data to be printed and remains constant. The main parameter of this element is the type of
the shape. Static Shape elements may be created on areas of any type.

Date/Time Field
At printing, this field displays the current date/time (that is, the time of printing). There are three variants
possible:

• Date - displaying only date.


• Date and Time - displaying date and time.
• Time - displaying only time.

Usually, this field is located in the header or footer of the report.

Page/Record Number
This field can display the following data:

• Page X of Y - returns the number of the report page and the total number of pages.
• Page - returns the page number.
• Number of Pages - returns the total number of pages in the report.
• Number of Records - returns the general number of records printed in the report. To return the number of
records in the group, use formula subRecN (to learn more, see the Grouping section).
• Absolute Record Number - returns the number of the record in the whole report. Functioning if the field
is located in the "Record Data Area".
• Record Number on Page - returns the sequence number of the record on the page. Functioning if the field
is located in the "Record Data Area".
• Number of Records on Page - returns the number of records on the page.
• Number of First Record on Page - returns the number of the first record on the page.
• Number of Last Record on Page - returns the number of the last record on the page.

105
User Input Field
This element displays text that any user can change in the preview window before printing.

For example, we have created a Report Style for printing the Invoice:

And we want the user who makes the Invoice to have a possibility to add any note to it (for example, special
conditions of shipping or payment). You can make this note as usual text but in this case it will be necessary to edit
the Report Style every time you make the Invoice, which is complicated and can be done only by the database
administrator.

To solve this problem, let us add to the end of the Invoice the User Input field and call it "Comments":

Now, at printing the Invoice, at the upper left part of the preview area we will see an additional field:

If we enter text in this field and click "Update", this text will appear in our Invoice:

The value that was entered at preview is saved and used by default at subsequent printing. You can create several
User Input fields for every Report Style.

Text Formula Field


Text Formula - allows adding a text formula to the report. Text Formula is a text string consisting of various
elements such as record field values, formulas, variables, system values, etc.

Examples of using Text Formulas in Report Styles:

• To display variable values - "Report Printed By: [$_user name]";


• To display several fields at a time - "Client Full Name: [First Name^text UCASE] [Second Name]".

106
EXPORT/SEND TEMPLATES
Using Export/Send Templates, you can perform the following operations:

• exporting data to a text file (txt, csv, xml, etc);


• generating a web page;
• creating and sending e-mails directly from your database or using an external e-mail client (Outlook
Express, The Bat, etc). Learn more...
• copying data from your database into the Windows clipboard to insert it into any application later on;
• inserting data from your database into an open Microsoft Word document or generating MS Word
documents automatically based on the database data.

These operations are united into one section as all of them are actually used to transform database records into text.
The Export/Send Template, therefore, defines the type of the result document(s) - (E-mail, Ms Word File, etc), and
the document content.

The content of the Export/Send Template is specified with a set of areas from which a final document is built up.
Every area represents a text formula; that is, beside a plain text, it may contain database fields, variables and so on.

For example, let us review a template containing the next areas:

Start Part: List of My Items.

Item Title, Price


---

Record Data: [Title], [Price]

End Part: ---


Report End

At exporting three records using this template, we will get the following document:

List of My Items

Item Title, Price


---
Phone, 100$
Car, 12000$
TV, 240EUR
---
Report End

That is, data from three records was united into one single text, tags [Title] and [Price] were replaced with values of
the corresponding database fields.

You can also create templates that will process every record separately. It means that you can get the following
items as a result:

• separate web pages;


• separate text files;
• separate Word documents or e-mail messages for each record.

Let's review an example of creating a template for e-mail notification with the help of records containing
information about clients. This template will have the following three areas:

107
To (E-mail): [Mail]

Subject: Happy New Year!

Body: Dear [Title] [Name],


I wish you Happy New Year!
Tom.

When this template is used for three records, three e-mails will be sent:

To: bill@gmail.com
Subject: Happy New Year!

Dear Mr Gates,
I wish you Happy New Year!
Tom.

To: mary@yahoo.com
Subject: Happy New Year!

Dear Ms Watson,
I wish you Happy New Year!
Tom.

To: ted@mycompany.com
Subject: Happy New Year!

Dear Dr Jones,
I wish you Happy New Year!
Tom.

Depending on the template type, it may have different number of areas and additional settings.

108
EXPORT/SEND TEMPLATES EDITOR
To open the Export/Send Templates Editor, select a corresponding type of template from the "Design DB-
>Export/Send Templates" menu:

If there are no templates in the database, the New Template wizard will be opened. If there is at least one template in
the database, you will see the Export/Send Templates Editor::

Here:

• 1 - Lists of templates to select for editing;


• 2 - buttons (create new template, specify settings for the selected template, delete the selected template, sort
templates);
• 3 - List of areas used to select the area for editing. More information about areas...
• 4 - Text editor used to edit the selected area content. Beside plain text, fields and variables, you can insert
here special tags permissible for this type of template. For example, if it is a template for creating a
Microsoft Word document, we can use the "<pagebreak>" to define the page break. Learn more about
tags...
• 5 - Quick insert and format buttons to insert fields, variables or formulas. To learn more, see the Text
Formulas section.

Click the Preview button to see how the active template works.

The Mass Replace button allows you to replace one and the same text in all or selected templates.

109
Template Properties
To open the Template Properties window, click the Modify Properties... button. Depending on the template type,
its properties window may look differently.

Properties of Web-page/Text Templates

• Template Name. Specify the name of the template used to identify the template.
• Output file(s) extension. Specify the extension of the output file(s).
• Replace the "Return" tag with. You have an option to replace the line break tag with any other in the
exported file. This option is especially useful when exporting to HTML files;
• Replace HTML tags. If selected, special HTML tags ("<", ">" etc.) will be replaced with their HTML
equivalents (&lt; &quot; &gt; etc).
• Don't open the created document after export. If this check box is selected, after files are created, they
will not be automatically displayed. By default, created files are automatically opened with the default
program.

Properties of Ms Word Templates

• Export data to the active MS Word Document. If this option is enabled and there is an opened MS Word
document, the data will be exported to it, beginning from the current cursor position.

Properties of E-mail Templates

Properties of a template for sending e-mails are extensive and are described in the "Mailing" section.

110
EXPORT/SEND TEMPLATES TAGS
Depending on the selected template type, you can use various special characters (tags) in its text to format output
data:

For a Web page (HTML)

You can use all html tags (<b>, <i>, <table>, etc.). To learn more about formatting web pages, visit the official site
of the html markup language.

For MS Word

In the current version you can use the following tags to format the text following them:

• <b> - bold text


• <i> - italic text
• <u> - underline text
• <strike> - strikethrough text
• <size=10>, <size=14>, etc. - set the font size of the text
• <font=Arial>, <font=courier>, etc. - set the font of the text
• <p> - begin a new paragraph
• <pagebreak> - begin a new page

To finish a tag, you should put an end tag - it is a tag with the same name, but with a slash, for example: </b>,
</font>, </size>. Some tags (<p>,<pagebreak>) do not require end tags.

For example, if you enter the following text into the area:

This is <b>bold</b> text. And this is <i>italic</i>.<p>New line.


<size=18><b><i>Big Bold Italic text</i></b></size>

You will get approximately the following:

This is bold text. And this is italic.

New line. Big Bold Italic Text


For Clipboard

There are no special tags, data will be copied into the clipboard according to the template. To make sure that the
template works, open any text editor (Notepad, WordPad, MS Word, etc.) and select the Paste command from the
Edit menu.

For Simple Text File

There are no special tags, data will be exported into a text file according to the template.

111
MAILING
There are two Custom Export Template types for mailing. They are:

• E-mail. Send one mail for each record.


• E-mail. Send one record data in one mail.

The only difference between these two template types is that records data can be sent in one e-mail or there can be
one e-mail for each record. But the mail configuration process for these types is the same.

Configuring Mailing Export Template

To configure the Mailing Export Template, click the Modify properties... button in the Custom Export Editor
window.

The Template Properties window has three tabs for mail configuration:

• General - here you can set the Name of the Export Template and specify the files that must be attached to
e-mails created with this template.
• Send Mail Using - here you can select the way for e-mails to be sent. You can set them to be sent using
your default mailing software or MS Outlook. You can also choose to send e-mail directly using the SMTP
protocol. In this case you will be offered to configure SMTP properties.
• BCC and Recipients - here you can set the program to use the Outlook contact list to select the recipients.
Then you can specify hidden recipients and choose to save a copy of your mail in MS Outlook.

General Tab

• Template name - use this area to specify the name of the export template.
• Include record attachments in e-mail - select this option to include record attachments to e-mail. In this
case, if a mailed record has attachments, these files will automatically be attached to an e-mail.
• Include the following files in e-mail - use this area to specify a custom list of attached files. Press Add
Files to choose the files to be attached from your computer. Press Add DB Files to select a custom record.
You will be able to select which of its attachments must be attached to the e-mail. Click Remove to remove
files from the attachment list.

112
Send Mail Using Tab

• Send e-mail(s) using default mailing software - select this option to send export e-mails automatically
using your mail program. In this case each time you perform Mail Export, your default mailing program
will be called, and the exported mail will be sent using its settings.
• Send e-mail(s) using Microsoft Outlook - select this option to send your exported e-mail using MS
Outlook.
• Send e-mail(s) directly from SMTP Server... - select this option if you do not want to use any mailing
software. You will have to configure your SMTP server using the following edit fields:
o SMTP Server - for example, smtp.myserver.com;
o Sender - enter your mailbox name;
o Account Name- for example, myaccount@myserver.com;
o Password - enter the password of your account;
o The server requires authentication - select this option if your server requires identification.

BCC and Recipients Tab

• Use Outlook contact list to select recipients - if this option is selected, each time Export to e-mail is
performed, you will be offered to select recipients from your MS Outlook Contacts List.
• Hidden recipients - this section allows you to specify hidden recipients for mailing. You can specify
hidden recipients manually (Manual Enter) or use the Outlook Contact List to select from it. You can
also create several distribution lists in MS Outlook. In contrast to Contact List, you will be asked to select
Distribution List only once, when configuring the template.
• Save a copy of mail in Microsoft Outlook - check this option if you want the system to leave a copy of
mail in Microsoft Outlook as Draft. It is necessary if you do not use MS Outlook as mailing software, but
want to save your correspondence in it.

Using scripts you are able to send e-mails with a single click. To learn more about scripts, see the Script Designer
section.

113
IMPORT/PARSE TEMPLATES
Templates of import and parsing allow you to automate the process of retrieving information from different sources
and importing it to the database. For example, with their help you can solve the following tasks:

• Importing currency rates from the news web-sites to the database.


• Checking incoming e-mails in Outlook and importing them to the database.
• Importing data from a plain text file.

As you can see, the importing tasks can be divided into groups according to the type of source. You can use the
following items as a source:

• Web-page
• Text file (txt, csv, etc)
• Ms Word document (doc, rtf)
• Mails from Outlook
• Drag-and-drop data (any text dropped to the program window). Learn more....

The template itself describes the way the imported text should be parsed and what should be done with it after that.
For example, if we import data on currency rates, the source text may look as follows:

12.01.2009, USD Rate=33.45


12.01.2009, EUR Rate=46.11
12.01.2009, GBP Rate=57.8

Correspondingly, the created template should:

1. Get the text from the specified web-site with currency rates.
2. Parse the text into lines. Then perform the following for each line:
3. Retrieve date, name of currency and rate.
4. Create a new record in the database.
5. Insert the retrieved date, name of currency and rate into the record fields.

All this the parser will perform automatically. The only things we should define are the source of data, folder and
type of records to which we want import text, as well as rules by which the text should be split over fields.

You can skip any of the 5 items or replace it with the script. For example, if we want to update data on currency
rates and do not want to create new records, we can use the script instead of items 4 and 5:

1. Select the record with data on a corresponding currency (using the query).
2. Replace the value of the currency rate field with a new one.

All this can be specified in the Import/Parse Template Designer.

The created template can be selected from the "File->Import/Parse" menu or from any script, using the
"Import/Parse Text" actions.

114
IMPORT/PARSE TEMPLATE DESIGNER
Templates of importing and parsing allow you to automate the process of retrieving data from different sources and
importing it to the database. You can create such template using the Template editor.

To open the Template editor, in the "Design DB->Import/Parse Templates" menu, select a corresponding type of
template:

The type of template defines the source of data.

Interface

The Parser Template Designer window is split into 3 parts:

• At the upper part, there is a list of available templates of this type.


• At the left part, settings of the current template are displayed on several tabs.
o General Properties of a Parser
o Fields/Variables Properties of a Parser
o Specifying Text Source for a Parser
o Scripts Properties of a Parser
• At the right part, there is a sample text for which it is intended. In the picture this is the code of a web-page
with currency rates.

Test Parser Button

The Test Parser button allows you to view how the selected template will work.

1. Test real work with real data import - performs full check of the parser work. That is, the text from the
specified source will be imported, it will be parsed, records will be created or the script will be executed.
2. Test on example text - the same as variant 1, but, instead of importing the text, the sample text (located in
the right part of the editor window) will be used.
3. Test only text separation - sample text will be parsed according to the rules specified on the "Fields/Vars"
tab, and the result will be displayed.

115
DRAG AND DROP PARSING TEMPLATES
This type of parsing is initiated automatically when the user drags text from any other program to the Brilliant
Database main window:

Let's assume that you are going to add some information about books from a popular web site www.amazon.com
into your books database.

To do so, you simply need to drag-and-drop the text with the required information about the books from the Internet
Explorer window into the window of the program we describe:


If your database already contains a template for parsing drag-and-drop information, records will be automatically
created in the database based on the text dropped:

If no template is available, the program will suggest you to create a new import/parse template.

Drag-and-drop Template special properties


As it was said above, this type of import, in contrast to other types, is initiated automatically when text is dragged to
the main window of the program. Let us assume that we have a number of such templates, one for importing data on
books from Amazon, another - from Google. To specify which template should be used for corresponding text, use
the "Keywords" tab in the template properties.

There are two lists on the tab:

• Allowed Keywords - if the dropped text contains all specified words, the selected template will be applied
to it.
• Disallowed Keywords - if the dropped text contains at least one word from the list, the selected template
will not be applied to it.

If two or more templates match by the keywords for parsing one and the same text, the user will be offered to select
a necessary template.

116
IMPORT/PARSE TEMPLATE PROPERTIES

General Properties of a Parser

• Parser Name - name of the template being edited;


• Parser Behavior - this field specifies the mode of data import:
1. Fill Current Record - imported data will be entered in the current record;
2. Create New Record - a new record (records) based on the imported data will be created, the
Separate Text check box becomes enabled. You should also specify a folder in which records
will be created, and the record type.
3. Import text to variables - if this type is selected, records will not be created and fields will not be
populated. Data will be copied to the specified variables that you can use in scripts afterwards.
• Separator between records - select this check box to split incoming text into parts, each imported as a
separate record. In the text field under the check box specify the string that will be used as a separator. In
the example with currencies, you can select a line break as a delimited - ";[BR]", is a special character that
indicates the line break. Data on every currency rate will be displayed starting from a new line.
• Skip first part. This check box is available if we parse text by blocks. If selected, the first block will be
skipped. This option may be useful if imported text with data has an unnecessary heading:

Date, Curency, Rate


11.11.2009, USD=1.51
11.11.2009, EUR=1.78

The "Date, Currency, Rate" heading will be skipped if the delimiter is the character of the line break and
the specified check box is selected.

Fields/Variables Properties of a Parser


This tab allows you to define in what way blocks of text will be parsed by fields and/or by variables:

Let us review an example with parsing currency rates. After parsing by blocks, we will have the following text as
input:

11.11.2009, USD=1.51

117
We need to place "11.11.2009" to the [Date] field, "USD" - to the [Currency] field, and "1.51" - to the [Rate] field.
To add a rule of parsing to the field, click the "Add..." button; to change the existing rule - click the Edit..." button.
The window with rule settings will be opened.

Here you should specify:

• Text From - line that precedes the value that we want to get. For example, the name of currency (USD) is
always between ", " and "=",; therefore, you need to specify "," in this field. For the currency rate (1.51) in
this field it is necessary to specify "=". The date is at the beginning, so this field should be empty (that is,
from the beginning of text).
• Up to - line that follows the value that we want to get. For example, the name of currency (USD) is always
between ", " and "=",; therefore, you need to specify "=" in this field. The currency rate is at the end, so this
field for it should be empty.
• To Field - in what field the value should be passed.
• To Variable - in what variable the value should be stored. This variable can be afterwards used in the
script that is called after parsing every block of text (see the "Scripts" tab).
• Apply Format - apply formatting to the retrieved value. For example, if we want the currency name to be
specified in the lowercase, you can define the formatting string "text LCASE", and then the value in the
field will be "usd", not "USD". Learn more about formatting...

Independent/Sequential Field Parsing

You can parse text by fields sequentially, as well as independently from other fields. The check box at the lower part
of the "Fields/Variables" tab is responsible for this:

In case of independent parsing, the search for value of every field is started from the beginning of the text. In case of
sequential parsing (the check box is not selected), the search for value of every field is started from the previous
field. Sequential parsing is convenient if we have the same characters as delimiters, for example:
11.11.2009,USD,1.51 In this case, for correct parsing we have to specify:

1. Field [Date]: From: "", Upto: ","


2. Field [Currency]: From: "", Upto: ","
3. Field [Rate]: From: "", Upto: ""

The value of the [Currency] and [Rate] fields will be taken not from the beginning of the text, but from the previous
value. This will also be reflected in the list of fields:

118
Specifying Text Source for a Parser
On the "Source" tab, the source of text for the parser is selected:

Depending on the type of template, you can select as a source a URL of a web-page, file path, Outlook folder and so
on.

The source can be fixed ("Always use same ...") - in this case, when a template is used, text will be automatically
taken from this template. This can be convenient, for example, if we use one and the same web-site to get currency
rates.

You may not select the source ("Always for ... each time") - in this case, every time the template is used, you will be
offered to select the source. This can be convenient, for example, if you have created a template for importing text
from Microsoft Word files.

This tab is not available in the template properties if the template has the "Drag-and-drop" type; in this case, any text
dragged to the program window is the source. Learn more....

Scripts Properties of a Parser


On the "Scripts" tab, you can define the script that will be executed after every block of text is parsed. Before the
script is executed, variables specified on the "Fields/Variables" tab of the template properties will be predefined.

Using Quick Insert Menu for Creating Parsers


The Quick Insert Menu allows you to easily fill in various template fields with the data from the incoming text. To
open the Quick Insert menu, select a part of the text and click the right mouse button:

• Set as the left boundary for the 'xxx' field - the selected text will be used as the left boundary for the
current field (see the Fields Tab);
• Set as the left boundary for the 'xxx' field - the selected text will be used as the right boundary for the
current field (see the Fields Tab);
• Add as a field data... - a new field will be added so that it contains the selected text. Accordingly, the text
to the left of the selection will be inserted as the left boundary, the text to the right of the selection - as the
right boundary;
• Add to allowed keywords - the selected text will be included into the list of allowed keywords (see
Keywords);
• Add to disallowed keywords - the selected text will be included into the list of disallowed keywords (see
Keywords);
• Copy to clipboard - the selected text will be copied to the MS Windows clipboard.

119
Parsing - Special Characters
• [BR] - line break;

Characters for definition of the import fields boundaries:

• [BEGIN] - beginning of the text;


• [END] - end of the text;

For example, to import the whole text into the specified field, specify [BEGIN] as the left text boundary and [END]
as the right one.

• [N=1], [N=2], etc.

This tag defines that the field boundary is the N occurrence in the text. For example, if we have the text:

The Lord of The Rings


J.R.R. Tolkien
30$

the following should be specified to extract the price:

• Left boundary: [BR][N=2]


• Right boundary: $[BR], since the search for the right boundary doesn't start with the beginning of the text,
but with its left boundary.

120
AUTOMATING USING SCRIPTS
ABOUT SCRIPTS

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.

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:

• Actions
• Variables
• If Statements
• Cycles (For Each ... Next)
• Go To Label
• Comments

Actions

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.

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

121
Variables

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.

122
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

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.

123
Cycles
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.

A cycle always begins with the For... string. To identify the end of a cycle body, use the Next Item action:

Lines between the For (2) and Next (4) lines make the cycle body. In this example, the cycle body contains only
one line (3).

This program uses cycles of three types that differ by the cycle subject:

• For interval (1,2,3...)


• For each line from text
• For each record from recordset
• For each match by regular expression
• For each record from SQL query (External DB)

For Interval (1,2,3...)

This cycle type changes the value of a specified variable in a specified range with a specified step and performs
enclosed commands. Example:

In this example, the [$i] variable changes its value from 2 to 20 with step 2. For each of these values, the program
will perform the commands contained in line (3), and the user will see 10 messages with the following text:

• Variable Value: 2
• Variable Value: 4
• Variable Value: 6
• Variable Value: 8
• ...
• Variable Value: 20

For each line from text

This cycle type splits text to lines, and performs the enclosed actions over each line. Example:

In this example:

• Line 1: Write the list of three cities in the [$cities] variable.


• Lines 2, 5: Define the cycle, in which the [$line] variable will consecutively contain a value from the list.
In our case, that's the list of cities contained in the [$cities] variable.

124
• Lines 3, 4: Cycle body. Line 3 creates a new record, and line 4 writes the city name to the Title field of the
record.

Thus, upon completion of this script, we will have 3 records with titles respectively London, Paris, and Moscow.

Any data source can be used with this cycle - data from file (see Read File), field values from DB records, etc.

For Each record from recordset

This cycle type allows performing operations over a set of records in a database. The records are defined in the
recordset variable that can be created with a query, relational field, etc. Learn more about recordsets...

In this example:

• Line 1: Places the set of records created by the All Records query to the [$rset] variable.
• Lines 2, 4: Define the cycle, in which all operations will apply to records stored in the [$rset] variable
instead of the current record.
• Line 3: Cycle body. Increments the value of [Field A] by one.

For each match by regular expression

This cycle splits a string by regular expression and executes the cycle's body for each match. Each submatch is
stored into a variable.

Parameters:

• Variables to copy matches to - variable name that will store matches. If regular expression returns
submatches, they will be stored in [$var_name0], [$var_name1], [$var_name2]... variables;
• Test String - a string to split;
• Regular Expression - a regular expresson in VBScripts format.

The following script will show different parts of all e-mails in the text stored in the [E-Mails] field:

1 For [$m] = Each Match in '[E-Mails]' by Regular Expression '(\w+)@(\w+)\.(\w+)'


2 Show Message (Name: [$m0]<BR> Sub-domain: [$m1]<BR> Domain: [$m2], RegExp Demo, Ok)
3 Next Item

E.g. if the [E-Mails] field contains:

tom@yahoo.ca some text


bill@gmail.com mary@msn.com

We will see 3 messages:

You can also use the "RegExp Match" action to get the first match or to check a string.

125
For each record from SQL query (External DB)

This cycle executes the "SELECT" query in an opened external database and executes the cycle's body for each
record from the query result.

Before using this cycle an external database (e.g. MySQL, Access, MS SQL, etc) must be opened using the
"Connect to External DB" action.

Parameters:

• Variable prefix - a prefix for variable names, which will store field values from the external database. E.g.
if you execute the "SELECT id, name FROM table_name WHERE 1" query and have selected
"a_" as a prefix, you will get the following variables: [$a_id] and [$a_name].
• SQL Query - SELECT query to execute. To execute other queries (e.g. UPDATE or DELETE) you should
use the "External DB SQL Query" operation.

Lets review an example that update currency rates from an MySQL database:

1 Connect to External DB (odbc;DRIVER={MySQL ODBC 3.51


Driver};SERVER=127.0.0.1;DATABASE=mydb1;UID=c;PWD=;OPTION=3;, etcurs)
2 For [$a_...] = Records From "SELECT name, rate FROM cur_rates WHERE 1"
3 Select Record By Rule (Rates, Rate And ([Currency Title] = "[$a_name]"))
4 Rate: [Currency Rate] = "[$a_rate]"
5 Next Item
6 Close External DB ()

This example:

1. Connects to an external MySQL database named "mydb1" under user "C";


2. Executes a query and run a cycle body (lines 3-4) for each record from the query result. The query returns
names and rates from the "cur_rates" table in the MySQL database;
3. Finds and selects a record by the [Currency Title] = "[$a_name]" rule.
4. Update the [Currency Rate] field value with [$a_rate] variable. Goess to the next query result;
5. Closes the connection to MySQL database.

126
User Functions
User Function is a script that can be executed from other scripts. For example, if you use a set of actions in several
scripts, you can create a User Function containing these actions and call this function when you need.

User Functions can accept arguments and return the result of their work to a specified variable.

For example, you can create a User Function that calculates a complicated formula basing on some input data and
returns the result to a variable. You can also record specified values to specified fields of a selected database record.

Using User Functions

Here is an example of simplifying the script described in Script Designer using a User Function:

First the script asks the user to enter the value of the [$quantity] variable that should exceed 0, then it increases the
value of the [Order Total] field of the current folder by the entered value.

Let's replace this part of the script with a User Function:

Creating a New User Function

To create a new User Function, click User Functions > Create New... or right-click the User Functions tree and
select Create New...:

Enter the name of the new User Function. For example, ChangeQuantity.

Click Ok to open the User Functions editor:

Editing User Functions

Editing a script in User Functions is similar to editing an ordinary script. See the Script Designer section for more
information.

As noted above, a User Function can accept arguments and return values to a variable. To set a User Function, click
the UF Setup... button or click User Function Properties... in the menu:

127
User Function Properties

• Name - specify the function name;


• Argument Name (1, 2, 3) - specify names of arguments where input variables will be recorded;
• Description (1, 2, 3) - argument description;
• Function returns value) - select this check box if you want the function to return its value. You can use
the text box on the right to describe the value.

If you change the User Function properties as shown on the illustration, predefined variables will appear in the
script tree of the UF editor:

You should record the result of the User Function to the [$result] variable at the end of the script.

We'll create a User Function using these variables:

Click Ok to save the User Function.

128
Variables

About Variables

This section outlines the guidelines for using variables in scripts.

Variables are used to store information that can further be used.

The values of variables can be set in scripts and user functions.

You can use variables almost everywhere: in math formulas, reports, queries, text formulas, custom export
templates, etc.

In formulas the variable is usually shown in brackets and the $ character is added before the variable name, for
example: [$a], [$order_date], [$text]. You can use all characters except [, ], $ and ^ in the variable name.

Variables Scopes

Starting from version 5.0, the program uses variable scopes. The variable scope defines the area where you can use
the value of the variable.

All variables can be divided into local, global, static, predifined and syatem:

• Local variables can be used only in scripts where they were created. For example, we placed a button on
the form, and when we click this button, the [$title] variable is created in the script with a Dear Mr/Ms. If
we add the output of this variable to the Report Style Template and click "File > Print...", we'll get an error
message saying that the variable wasn't found. However, if we add a print command to the script where the
variable was initialized, its value will be printed out in the report.
• If the variable is declared as Global, it can be used in any part of the program. For example, if the [$title]
variable was global in our example, we wouldn't get an error trying to print the text without adding the
corresponding command to the script where the variable was declared. However, when we close the
database, the variable value will be erased.
• In contrast to global and local variables, the values of Static variables are stored in the database file and
arent erased when we close the database. In networked mode it value is same to all users, so if one user set
the variable [$x] value to "Hello World" and other users read this veriable they all will see the "Hello
World" value.
• Predefined. A predefined variable is a local variable, but unlike local variables it's defined before the script
is executed. For example, the arguments of User Functions or variables given to the script after parsing are
predefined variables.
• System Variables are global variables that contain system values like the current time, name of the
database user, etc. Their values cannot be changed.

All variables are shown in the variable tree. To make a local variable global (or static), right-click it and select the
"Make Global" (or "Make Static") menu item:

Creating/Modifying Variables

To add a new variable to the script (or modify the existing value), click Add Variable in Script Editor:

129
Enter the name of the variable in the dialog box. Select the check box on the right to make the variable global:

After that, select data the variable should be based on. Depending on the data type, the variable creation dialog box
can look differently.

By type, all variables can be divided into:

• Text/Math/Date - regular variables that store text, numbers, dates, etc.


• RecordSet - variables that store a record list for the further use or modification.

Creating Text/Math/Date Variables

Regular variables containing text, numbers or date can be defined in one of the following ways:

• By Math Formula
• By Text Formula
• By User Input:
o By entering a text
o By selecting one value from a list or a popup menu
o By selecting a date from the calendar
o By selecting a file using the "Open 'File' dialog box"
o By using a form

To create a variable click the "Add Variable" button in the Script Designer and select a type:

By Math Formula

Set the value of the variable using a mathematical formula.

In the formula you can use the values of other variables, database fields, queries, etc. Learn more about formulas...

Examples

[$orders] = queRecN(|All Orders|). Sets variable orders as the number of records from the All Orders query.

[$orders] = [$orders]+[Quantity]. Increases the value of the [$orders] variable by the value of the Quantity field
of the current record.

Note: if you want to use the field values of the current record, don't forget to specify its type in the Use the
following record type text box:

By Text Formula

Set the value of the variable using the text formula.

130
Text Formula is a text string that consists of several elements such as values of the record fields, formulas, variables,
system values, etc. Learn more about text formulas...

Examples

For example, there is a record with the First Name and Last Name fields that store the Thomas and Anderson
values accordingly.

[$full_name] =[First Name] [Last Name^text UCASE]. Sets full_name as value Thomas ANDERSON.
ANDERSON capitalized, according to the UCASE formatting.

[$full_name] = Dear [$full_name]. Adds prefix Dear to variable [$full_name]. Now [$full_name] equals to "Dear
Thomas ANDERSON".

Note: if you want to use the field values of the current record, don't forget to specify its type in the Use the
following record type field:

By entering a text

Set the value of the variable using the edit field.

The user is offered to input the value of the variable directly while the script is being executed, for example:

The default value and the message text can be set by using text formulas.

By selecting one value from a list or a popup menu

The user is offered to select a value on the list as the variable value.

Options:

• Input window text - value-entry window title; e.g., you can enter Select a value from the list.
• List of values - the list of values - one value per line; for example:
London
Moscow
Paris
• List Style - can contain one of two possible values and defines the appearance of the value-entry window:

131
By default, this action puts the selected value (e.g., Moscow) to the variable. However, you can have the program
put the value identifier instead of the actual value to the variable. To make that happen, the list items are to be
defined as identifier > value pairs; for example:

1 > London
2 > Moscow
3 > Paris

In this case, the list will appear the same way, but the selection of, for instance, London will write 1 to the variable.

This method is especially useful for the further work with the values in formulas. For example, this way you can
make the tax selection:

0 > No taxes
17.5 > VAT (17.5%)
5 > Internal 5% tax

Depending on the selected value, the variable will have 0, 17.5 or 5.

The list text can be set by using text formulas.

By selecting a date from the calendar

In this case, the user will be offered to select a date using the calendar:

Options:

• Default Date - date set by default.


• Result Date Format - this property is outdated;
• Dialog Caption - the caption text of the calendar dialog.

By selecting a file using the "Open 'File' dialog box"

In this case the standard Microsoft Windows "Open File..." dialog box will appear:

Options:

• Dialog Caption - the caption text of the "Open File" dialog.


• Filter - filter for file types, e.g.:
o *.* - all files
o Pictures (*.bmp;*.ico;*.gif;*.jpg;*.png)|*.bmp;*.ico;*.gif;*.jpg;*.png

132
o Documents (*.doc)|*.doc
o Bitmaps (*.bmp)|*.bmp

The "|" symbol separates a title and a mask.

By using a form

Here, the user is shown the selected form in a different window, and field values are inserted into the variables:

Learn more about this way of data entry...

Creating Recordset Variables

Introduction

RecordSet Variables are variables that store lists of records. Recordsets can be used for the mass modification of
records, printing records, modifying relational fields, etc.

• How to create a RecordSet?


• Usage of RecordSet variables
• Examples

How to create a RecordSet?

By Query

The variable will have records selected from the database by the specified query.

Parameters:

• Query - the query that will select database records for writing to the variable.

By Relational Field

The variable will have records stored in the many-to-many relational field or simple relation field of the current
record. For example, if we have the Book type record, and it has the Authors relational field, we can create a
recordset variable, to which we will place authors from the Authors field and then print them.

Parameters:

• Relational Field - the relational field the records are to be taken from;
• Records - which records are to be selected: Selected - selected only, All records - all records in the field;
• Filter For Records - specifies additional rules for filtering records.

By Filtering Recordset

133
In this case, the records variable will be created by applying a filter to an existing recordset. For example, we can
create a recordset based on records selected By Folder Input and then remove some records from it.

Parameters:

• Source Recordset - variable with the source recordset;


• Filter For Records - rules for filtering records.

By Recordset Input

The user will be offered to choose one or several records from the existing recordset.

For example, a recordset can be created by means of Query, and the user can be offered to choose one record from
the query results.

Parameters:

• Source Recordset - variable with the source recordset;


• Window Title Text - the window title text for the record selection window;
• Number of Records - the number of records possible to be chosen in this window.

By Folder Input

The user will be offered to select necessary records from a database folder.

Parameters:

• Folder - folder from which records are to be selected;


• Record(s) input properties - record-entry window properties. More...
• Number of Records - the number of records, possible to be chosen in this window.

By Standard Set

Recordset will be created based on one of the standard record sample:

Parameters:

• Record Type - record type for records in the recordset.


• Source - source of sampling:
o Auto - selected items in the current record folder. If there are none, then last query results.
o Current Record - the current record opened in the main window;
o Records in Current Folder - all the records in the current folder;
o Selected Records - selected records;
o Query Results - last query results;
o Recordset variable... - variable set from another Recordset;
o Left/Center Query Window - recordset kept at the left\center window of query results;
• Number of Records - the number of records possible to be chosen in this window.

By Boolean Operation

Recordset will be created based on the result of a boolean operation on two other recordset.

Parameters:

• Recordset A, Recordset B - source recordsets;

134
• Operation. Lets assume that the recordset A contains records 1, 2, 3. And the recordset B contains records
2, 3, 4.
o OR - returns combination of two recordsets into one. I.e. it returns all records from both
recordsets (1, 2, 3, 4);
o AND - returns intersection of two recordset. I.e. it returns only records which is both in the
recordset A and the recordset B (2, 3);
o SUB - returns substraction of the recordset B from the recordset A. I.e. it returns records from the
recordset A without records from the recordset B (1).

Other means

In order to create a relational variable, you can use forms for data entry. To learn more...

Usage of RecordSet Variables

Further on this variable can be used for the following purposes:

• Execute a script for these records. For example, change field value for all the records. To learn more, see
the For Each record from recordset cycle section.
• Print or custom export these records.
• To automatically add or remove records in the relational fields. Use the Change relational field action.
• To carry out calculations for the selected records in mathematical formulas. For example, get the number of
records, total by one of the records' fields, etc. Use functions setMathOp() and setRecN().
• To display record data fields using the RSET formatting.

Examples

Adding Records to Relational Field

A sample of a script that carries the selected records from the many-to-many Field_A to Field_B and displaying the
number of carried records:

Changing Records

In this example:

• Line 1: Places set of records created with the All Records query to the [$rset] variable.
• Lines 2, 4: Defines the cycle, in which all operations will apply to records stored in the [$rset] variable and
not to current records.
• Line 3: Cycle body. Increase the value of the record's [Field A] by one.

Using forms for entering variables

Introduction

Forms can be used not only for data storage, but as well for entering variables and using them afterwards in scripts.

Using forms for entering data, it is possible to enter several values in a convenient form.

135
Description

Any form can be used as a form for data entry. For example, let's create a form with three fields and name it as
Form1:

The fields are of following types: simple text field, date field, many-to-many relational field. If the database has no
other forms, the created form may be indicated as a reference form for the many-to-many relational field.

Now, let's create a toolbar button, by clicking which a data entry form will be shown.

1. Open Toolbar Editor and create a new button.


2. In the opened script editor, click the Add Variable button and choose the Set Vars By Form option from
the menu.
3. This action will show you a form, and after the data entry will create variables, the names of which consist
of two parts: user-set prefixes and field name. If we choose the var_ prefix, then in our example the
following variables will be created: var_title, var_date, var_notes, var_notes_sel, var_. The origin of the
two latest variables will be covered later. So, set up the following input parameters:
o Prefix: var_
o Form: form1
o Form title text: Testing Form Input.
4. Add one more script line in order to show entered values:

Run the script and enter the following data:

Click Ok. The variables will be created within the script, and you shall see the following message:

[$var_notes] variable is a recordset, with relational field entries. The [$var_notes_sel] variable is a recordset with
entries selected at the moment of clicking the OK button. Recordset variables can be used, for instance, for
operations in a recordset. To learn more, see the Usage of RecordSet Variables section.

136
The variable with the name of the selected prefix ([$var_]) is equal to 1 in case the user has clicked Ok. It is empty
if the user has clicked Cancel or just closed the window.

Pre-check of entered data

It is possible to add a pre-check of entered data in the form editor.

1. Open the form editor, choose a form for a data entry, and go to the Scripts and Behaviour tab.
2. Set the On Confirm option equal to Execute Script:

3. To cancel data entry using the script, if it happens that the user did not fill the form correctly, set the
[$cancel] variable equal to 1.
Let's create a script to verify the Title field entry:

4. Save the script, close the script editor. Click the toolbar button to open an input window. Leaving the field
empty, click Ok. If the script is composed correctly, you shall see a warning about incorrect data entry, and
the window shall resume opened:

The On Confirm verification script is also executed on creating a new record with the help of the popup form.

137
System Variables

This section describes all system variables that can be defined in scripts.

Date and Time

• [$_date] - returns the current system date;


• [$_time] - returns the current system time;
• [$_server time] - returns the system time on the server cmputer. Using this variable can be actual if users
from different time zones use the database;
• [$_timer] - returns the number of seconds elapsed since midnight (e.g. 834.12 or 51023.45).

Users and Groups

• [$_user name] - returns the name of the user working with the database (see Users and Groups for more
information);
• [$_user group name] - returns the name of the group to which the user working with the database belongs
(see Users and Groups for more information).
• [$_users] - returns the list of all users in current database.

File paths

• [$_software path] - contains the path to an executable file of the program without the ".exe" extension. For
example, if the database is opened with the program residing in "C:\Program Files\DBApp
v1\DB_App.exe", the variable will contain "C:\Program Files\DBApp v1\DB_App";
• [$_database path] - contains the path to the current database, for example "C:\MyDocs\MyDB1.bbd";
• [$_myfiles] - contains the path to the folder in which the database is located (for example, "C:\MyDocs").
If the SDK version of the program is used, this variable will contain the path to a special "myfiles" folder.
Learn more....

Current Folder

• [$_cur folder name] - returns the name of the current database folder, for example, "New Orders".
• [$_cur folder path] - returns the path to the current folder. The value always starts with a word "Root", for
example: "Root\All Orders\New Orders".
• [$_cur folder id] - returns the system ID of the current folder, for example, 67 or 105. This ID can be used
for explicit identification of the folder or for defining the folder in scripts. For example, in the Select
Folder" or "Add Record (Folder, ...)" actions.
• [$_parent folder id] - returns the ID of the parent folder (the folder in which the current folder is located).

Other

• [$_command line] - returns command line parameters with which the database was started. Learn more
about supported parameters....
• [$_rec write] - returns 1 if the current record can be accessed for writing; otherwise 0 is returned.
• [$_main window] - returns 1 if the script was started from the main window of the program and 0 if the
script was started from another window with the record (for example, if the record was opened in a new
window from a relational field).
• [$_hwnd] - returns HWND for a window that can process incoming WM_USER and WB_COPYDATA
messages. More information is in the "SendMessage, WinAPI" section.

138
Events
This section describes events in Brilliant Database for which scripts can be created, and specifies what predefined
variables can be used in these events. For example, for the "On Edit" event the [$old_value] variable is available
into which the value of the field before it was changed is written.

For a Form (Record)

Scripts for the form events are specified in the form properties on the "Scripts and Behaviour" tab.

On Record Select

This event is called right after the user passes to the record in the following cases:

• The record is selected in the main program window (for example, from the list of records in a folder)
• The record is opened in the pop-up window (for example, on clicking the relational field)
• The form for specifying variables is opened

On Confirm

This event is called when the user finishes editing the record (before changes are saved). This event allows you to
perform data check.

Predefined variables:

• [$cancel]. If you set the value of this variable equal to 1 in the script, the record will not be closed and
saved. For example, in such script you can check if values in all fields of the records are specified correctly
and, if something is wrong, display a warning message and set [$cancel] = 1.
• [$is_ok]. If the user is editing a record in a separate window, the [$is_ok] variable will contain information
about the way the user tried to finish work with the record: "1" - clicking the "OK" button, "0" - clicking
the "Cancel" button or closing the window.

Note: This event will be called only if the record has been changed.

On "Add" Action

Brilliant Database has a number of standard methods to create a new record not using scripts:

• From the "Add->..." main menu


• By pressing the "Ins" key on the list of records in the current folder

You can predefine these actions by specifying your script in the 'On "Add" Action' property - for example, to add
preliminary data input.

Predifined variables:

• [$type] - where the script can be called from. Possible values:


o "menu" - from the "Add" menu
o "list" - by pressing the "Ins" key

For a Field

Scripts for field events are specified in the field properties on the "Scripts and Behaviour" tab.

139
On Edit

This event is called when the user finishes editing a field. For example, if you have three fields [First Name], [Last
Name] and [Full Name], for the [First Name] and [Last Name] you can specify a script in the "On Edit" event that
will automatically update the value of the [Full Name] field.

Predefined variables:

• [$old_value] - this variable contains the value of the field before the field was changed.

On Left Button Click

This event is called at the left mouse click on the field. The event is available not for all types of fields.

On Right Button Click

This event is called at the right mouse click on the field. The event is available not for all types of fields.

On Double Click

This event is called at the double mouse click on the field. The event is available not for all types of fields.

On Enter Key

This event is called when the "Enter" key is pressed. The event is available for simple text fields.

On "Ins/Del" Key

This event allows you to predefine the standard action that will be called when the "Ins/Del" is pressed on the many-
to-many relational field.

• [$key] - the pressed key that can be "Ins" or "Del".

Misc

These events can be edited from the Script Editor ("Design DB->Edit Scripts..." menu).

On WinAPI SendMessage

This event is called when a message sent from another program by means of WinAPI SendMessage is received.

Predefined variables:

• [$wparam] - WParam value, for the WM_USER message (number);


• [$lparam] - lParam value, for the WM_USER message (number);
• [$dwdata] - dwdata value from the COPYDATASTRUCT structure (number);
• [$lpdata] - lpdata value from the COPYDATASTRUCT structure (string).

On Network SendMessage

This event is called when a message sent by means of Send Network Message is received from the database user.

Predifined variables:

• [$text] - message text

140
• [$from] - name of the user who sent the message
• [$cancel] - if at script execution the value of this variable is equal to "1", the message will not be added to
the Notification Area when it is received. The database will also be blocked/unblocked if the message
contains the corresponding instruction.

Notification Button Click

This event is called when the user clicks the notification button in the notification area. To create a notification, use
the Show Notification action.

Predefined variables:

• [$text] - text of the notification


• [$btext] - text of the notification button
• [$pars] - content of the string specified in the "Pass to the notification script" parameter of the Show
Notification action used to create this notification.

141
SCRIPT DESIGNER
By using Script Designer 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 script designer only. To find out what actions can be used in scripts and the basics of
scripting functionality, see the Scripting Basics chapter.

To get access to all database scripts, in the Designer menu select the Edit Database Scripts menu item. A new
script is to be assigned to the location it should be used. For example, for a toolbar button, the script should be
assigned to ToolBar Editor.

Interface
The Script Designer window:

The window includes the following elements:

• Tree-like list at the left part of the screen that shows:


o The list of global and used in the edited script variables;
o The list of database user functions;
o If the script editor was opened from the Designer menu, this list allows opening any database
script for editing (the Browse tab).
• Main menu;
• Buttons for adding/deleting script lines;
• Main window for script editing.

Main Menu

• Script Menu
o Save Changes and Close - used to save the changes made to the script and close Script Designer.
o Exit without saving - used to exit the designer without saving changes.
o Close - used to close the script editor if it was opened from the Designer menu.

• Debug Menu has script debugging instruments. To learn more, see Script Debugging. This menu option is
available only if the script editor is opened from the Designers menu.

• Edit Menu

142
o Edit Line - used to edit the current line (for example, change the rule for If or parameters for
action). You can also perform this command by double-clicking the script line.
o Hide/Show Block of Code - used to hide/show the block of code located between the If and End
If statements;
o Cut - used to cut selected lines from the script;
o Copy - used to copy selected lines;
o Paste - used to paste copied lines into the script;
o Delete - used to delete selected lines from the script.

• Add Line Menu - use this menu as an alternative to buttons for adding a new line to the script.

• User Functions Menu


o Insert... - used to add a User Function to the script;
o Create New... - used to create a new User Function;
o Modify Existed... - used to modify an existing User Function.
Learn more about User Functions...

• Help Menu - used to open the help file that you are currently reading.

Hot Keys

When working with a script, it is recommended to use hot keys. Hot key combinations marked with * work only
when the Script Designer window is selected.

Description Hot Key


Get help F1
Save changes and quit Ctrl+S
Exit without saving Ctrl+F4
Switch to one action Ctrl+F5
Hide/Show block of script F2
Add action Ctrl+A
Add variable Ctrl+B
Add comment Ctrl+T
Add if rule... Ctrl+I
Add else... Ctrl+E
Add else if rule... Ctrl+Y
Add if confirm(...) Ctrl+R
Edit current line Enter*
Delete current line Del*
Move current line upper [*
Delete current line lower ]*

143
Action Editor Interface
Action Editor allows the user to configure an action performed in a script.

An action means any operation, for example, Change Field Value, Open a Database, Import Records, Exit the
Application, Print Records, etc.

The Action Editor Window:

In this editor, you can set actions parameters using fields at the center of the window. For example, the picture
above shows the Show Message action and its parameters.

Required parameters are highlighted with bold (Message Text).

Click the (...) button to change the parameter in a comfortable window (e.g. text editor for text parameters).

To select default value click the "D" button.

If the action returns its result (for example, the Show Message action returns the title of pressed button (ok, cancel,
yes, no), a text box appears below. Use this textbox to specify the name of the variable where the action result
should be saved:

If you point at the text box, a tooltip describing the returned value will appear. You can find more details about the
usage of variables in the Script designer and Variables sections.

To save changes and close the editor window, click OK.

144
Script Debugging
Script debugging is a powerful tool that may help you to understand script work and find errors if something works
wrong.

To get access to debugging menu, run the script editor from the main menu: Designer > Edit Database Scripts.
The debugging option will be disabled if the script editor is opened from another place.

The Debug menu contains the following options:

• Start - used to run the script;


• Start Debug - used to execute the script, but the script execution stops before the first command. This
option allows watching the script work step by step.
• Toggle Breakpoint - used to create or delete a breakpoint for the selected script line. While executing the
script, but before running a line with a breakpoint, the program will stop so that you can check variable
values or change the script execution order.
• Stop on BreakPoints - if this option is not selected, there will be no stops at breakpoints while script
execution. It is convenient to disable this option if you want to see the script work in the normal mode, but
you don't want to delete the created breakpoints.

When the script execution is stopped at a Breakpoint, or it has been executed via the Start Debug option, a
debugging window will appear on the screen:

This window is similar to Script Editor, but is used for analysis of a script work. The command, before which the
script has been stopped, is shown in red. Note that this command has not been executed yet.

In the left part of the window a list of local and global variables, used in the script, is shown, together with their
values.

At the top of the window there is a debugging control panel:

• Continue - used to continue script execution starting with the current command.
• Next Line - used to execute the current command and stop the script for debugging. This button is useful
when you need to check how the command affects variable changes.
• Skip Line - used to skip the current line and go to the next one.
• Skip Sub - used to end the current cycle or activated user function.
• Stop - used to stop script execution and return to the script editor.

Be careful using the Skip Line/Sub command in debugging. Skipping a part of the script will affect its
functionality.

145
CALCULATIONS
Use of formulas makes it possible to automate processing data in your database. For example, your database stores
prices for some goods and quantities of the goods. You may use the [Cost]*[Quantity] formula to calculate the total
cost of the goods. You may use even more complicated formulas containing functions working with a set of records.
For example, the repMathOp(|Cost|,|SimpleAverage|) function will calculate simple average of costs in the set of
records that the edited report incorporates.

You can access Formula Editor in the following ways:

• Create a Mathematical Field on the form using Form Editor.


• Add a Formula Field into the report using Report Style Editor.
• Create a button with the Apply Formula to a Field action using Scripts.
• Create a mathematical variable.

FORMULAS EDITOR
Formula Editor User Interface

Formula Editor is a tool for editing formulas used in your database. The Formula Editor window consists of the
following parts:

 1 - Pane for quick insertion of field values and variables.


 2 - Pane for quick insertion of functions and constants. The appearance of this pane may vary depending
on the cursor position in the edit pane. For example, there can be a button to insert a constant particular to
the edited function.
 3, 4 - Current function and its parameters description. When the cursor is positioned inside a function,
this pane shows a brief description of this function and the list of its parameters. Double-click any
parameter to open a quick insert window.
 3 - Edit pane. Displays the formula. This pane allows manual formula editing.

While editing the formula, you may press the Ins key to open a quick insert window to add a constant or a field
value. Most formulas support this feature.

Formula Composition Basics

You can use the following elements to build formulas:

 Prime and fractional numbers;


 Simple operations - addition (+), subtraction (-), multiplication (*), division(/), residue of division (%) ;
 Brackets;
 Functions, including logical ones;
 Current database field values. Designated by square brackets: [Field Name].
 Constants and field identifiers. Designated by vertical bars: |Constant Name|.

Operation precedence:

146
• First - actions in brackets;
• Second - all other conditions being equal, multiplication and division operations have higher priority over
addition and subtraction;
• Third - all other conditions being equal, expressions are evaluated from left to right.

Simple Examples

• 2+3. This example uses two numbers (2 and 3) and one operator. The result is 5.
• 2*5+3. This example uses three numbers (2, 5 and 3) and two operators. The result is 13.
• 2*(5 + 3). This example uses three numbers (2, 5 and 3), two operators and two brackets. The result is 16
as the sum in brackets 5+3 is calculated first.
• int(6.3). This example uses one number and the int function returning the integer part of the number, with
two brackets. The result is 6.
• int(3.9+1.3). This example returns the integer part of the sum of 3.9 and 1.3. The result is 5.
• [Cost]. This example returns the value of the Cost field.
• int([Cost]). This example returns the integer part of the value of the Cost field.
• [Cost]*[Quantity]. This example returns multiplication of the cost and quantity fields.
• If([Cost],|>|,100). This example returns 1 if the cost is greater than 100; otherwise 0 is returned.
• If([Cost],|<|,100). This example returns 1 if the cost is less than 100; otherwise 0 is returned.
• If([Cost],|>|,100)*[Cost]. This example returns the cost value if the cost is greater than 100; otherwise 0 is
returned.
• repMathOp(|Cost|,|Sum|). This example returns the sum of costs of all records in the report. In this case |
Cost| is an identifier that denotes the fields to sum up, and |Sum| is a constant of an action to perform.
• repMathOp(|Cost|,|SimpleAverage|). This example returns the simple average of costs of all records in the
report.
• If(repMathOp(|Cost|,|SimpleAverage|),|>|,100). This example returns 1 if the simple average of costs of all
records in the report is greater than 100; otherwise 0 is returned.

147
FUNCTIONS DESCRIPTION

List of Functions
Math/Logic Functions
Abs - returns the absolute value;
Cos - returns the value specifying the cosine of an angle;
Exp - returns e (exponent) raised to the power of a value;
If - returns 1 if expression is true, otherwise 0 is returned;
Int - returns the integer portion of a number;
Log - returns the value specifying the natural logarithm of a value;
Pow - returns base raised to the power of exp.;
Round - returns the rounded value to specified precision;
Sgn - returns the number indicating the sign of a value;
Sin - returns the value specifying the sine of an angle;
Sqr - returns the square root of a number;
V - returns the value of a variable.

Date Functions
dateSerial - returns the date for the specified year, month and day;
datePart - returns the specified part of the date;
dateCurrent - returns the current system date;
dateDiff - returns the interval between two dates;
dateAdd - returns the date shifted from date to a specified interval;

Data Functions
F - returns the value of a field of the current record;
RF - returns the value of a field of the specified record;
FLen - returns the length of a field of the current record;
User - returns user input.

Functions for Recordset


Return results of operations (sum, avrage, etc) for records from:
folMathOp - specified folder;
mmrMathOp - many-to-many field ;
setMathOp - recordset stored in a variable;
queMathOp - query results;
repMathOp - report;
subMathOp - grouped records in a report;
cexMathOp - custom export;
Return numbers of records in:
folRecN - specified folder;
mmrRecN - many-to-many field;
setRecN - recordset stored in a variable;
queRecN - query results;
repRecN - report;
subRecN - grouped records in a report;
cexRecN - custom export.

148
Data Functions
F (|Field|)

Returns the value of Field of the current record. This function is equivalent to the square bracket operator [].

Examples:

F(|Price|), returns the price field value;

F(|Quantity|)-[Quantity], always returns 0,

RF (RecordID, |Field|)

Returns the value of Field of a record with RecordID.

Examples:

RF(107,|Price|), returns the price field value of a record with ID=107;

FLen (|Field|)

Returns the length of Field of the current record.

Examples:

If Title field of a record is "Record", FLen(|Title|) returns 6 (number of chars);

If Title field of a record is "Hello", FLen(|Title|) returns 5.

Special Functions for Script Designer

Note. This function is available only when editing scripts.

User(DefaultValue) - only for script designer.

This function opens an input dialog and prompts the user to specify its value. For example, when the user clicks the
button that changes the value of the Quantity field according to the formula: Quantity=[Quantity]+User(1), the
value of the Quantity field is increased by the specified value. If the user clicks Cancel, the calculation of the
formula is aborted. The optional parameter DefaultValue is used to define the default value of the function.

Instead of this function it is recommended to use a script with preliminary input of data into the variable.

149
Date Functions
Note. Date functions use their own internal numeric representation of dates. However, the mode of the date
representation can by modified so that the result of the formula is displayed as a date instead of numerals. To modify
the mode, use the formatting string starting with the word Date (not Math), e.g., "date dddd, mmm d yyyy" will be
displayed as Monday, Feb 2 2004.

dateSerial (Year, Month, Day)

Returns a date for the specified year, month, and day. The function converts the date specified by year, month, and
day into the internal format.

Examples:

datePart(dateSerial(1983,4,16),|Year|), returns 1983;

datePart(dateSerial(1983,4,16,|Day|), returns 16.

datePart (Date, |Part|)

Returns the specified part of the date.

Examples:

datePart(dateSerial(1983,4,16),|Year|), returns 1983;

datePart([Order Date],|Month|), returns month of the date stored in the record field value with name "Order Date".

dateCurrent()

Returns the current system date. The function converts the date specified by year, month, and day into the internal
format. The return value may only be used within the application.

Examples:

datePart(dateCurrent()), returns today's day;

dateDiff (dateA, dateB, |Interval|)

Returns the value specifying the number of time intervals between two dates specified. The interval parameter
contains the interval of time to calculate the difference between dateA and dateB.

Examples:

dateDiff(dateSerial(2004,10,20), dateSerial(2004,10,16), |Day|), returns 20-16=4

dateDiff(dateSerial(dateCurrent(), [Order Date], |Month|), returns the number of months since the date stored in the
record field value with name "Order Date".

150
dateAdd (dateA, Interval_len, |Interval|)

Returns the date shifted from date dateA to a specified interval Interval_len defined in days, months or years. The
unit measure is defined by parameter Interval.

Examples:

dateAdd(dateSerial(2004,1,1),5,|Day|), returns 6 January 2004

dateAdd(dateSerial(2004,1,1),32,|Day|), returns 2 February 2004

dateAdd(dateSerial(2004,1,1),2,|Month|), returns 1 March 2004

151
Math/Logic Functions
V (|VariableName|)

Returns the value of a variable with the VariableName name. You can also simply type [$VariableName] into a
formula to get the value of the variable. To learn more about variables, see the Variables section.

Abs (Value)

Returns the absolute value of Value.

Examples:

Abs(-9), returns 9;

Abs(3), returns 3.

Cos (Angle)

Returns the value specifying the cosine of an angle.

Examples:

Cos(90), returns 0;

Cos(60), returns 0.5.

Exp (Value)

Returns e (exponent) raised to the power of Value.

Examples:

Exp(1), returns 2.7182.

Exp(0), returns 1;

If (valueA, |opearation|, valueB)

Returns 1 if valueA operation valueB is true;

Returns 0 if valueA operation valueB is false.

List of operations: equal, more, less, more or equal, less or equal.

Examples:

If(5, |more|, 3), returns 1, because 5 is greater than 3;

If(2, |equal|, 7), returns 0, because 2 is not equal to 7.

If you need advanced logical structures, please use scripts.

152
Int (Value)

Returns the integer portion of a number.

Examples:

Int(1.76), returns 1

Int(-6.32), returns -7

Log (Value)

Returns the value specifying the natural logarithm of Value.

Examples:

Log(1), returns 0

Log(2.7182), returns 1

Pow (Base, Exp)

Returns Base raised to the power of Exp.

Examples:

Pow(1, 12), returns 1

Pow(2, 3), returns 8

Round (Value, Precision)

Returns the rounded Value to specified Precision (number of digits after the decimal point).

Examples:

Round(1.234), returns 1

Round(2.23835324, 2), returns 2.24

Round(-2.234, 2), returns -2.23

Sgn (Value)

Returns the number indicating the sign of Value:


-1 if less than zero;
0 if equal to zero;
1 if greater than zero.

Examples:

Sgn(-12), returns -1

Sgn(0), returns 0

153
Sgn(3.4), returns 1

Sin (Angle)

Returns the value specifying the sine of an angle.

Examples:

Sin(90), returns 1;

Sin(0), returns 0.

Sqr (Value)

Returns the square root of a number [A1].

Examples:

Sqr(9), returns 3;

Sqr(1), returns 1.

154
Functions for Recordset
...MathOp Functions

The following functions carry out operations (summation, subtraction, average computing, etc.) over a set of records
and differ only in the type of the source of records.

• folMathOp (FolderID, FormID, |Field|, |Operation|) - records are retrieved from the folder with FolderID.
• mmrMathOp (|RelationalField|, |Field|, |Operation|) - records are retrieved from the many-to-many field
(the RelationalField parameter).
• setMathOp (|VariableName|, |Field|, |Operation|) - records are retrieved from the variable with the
VariableName name.
• queMathOp (QueryID, FormID, |Field|, |Operation|, Var1, Var2) - records are generated on the basis of
the query with QueryID. You can use the optional variables Var1 and Var2 to set the User Input query
parameters.

The following 3 functions can be used only with the Report Styles or Export/Send templates:

• repMathOp (|Field|, |Operation|) - operation over records selected in the report (for printing).
• subMathOp (|Field|, |Operation|) - operation over records grouped into the report (for printing).
• cexMathOp (|Field|, |Operation|) - operation over records selected in Custom Export.

The Field parameter defines the record field over which the operation is to be carried out.

The Operation parameter defines the operation itself. For example, there are three records with values 1, 2 and 3.
Then:

• Sum - sums values (1+2+3=6);


• SumOfSquares - calculates the sum of squares (1*1+2*2+3*3=14);
• SimpleAverage - calculates simple average ((1+2+3)/3=2) ;
• Quantity - returns the number of records (=3);
• Min - returns the smallest value of the set (=1);
• Max - returns the greatest value of the set (=3);
• First - returns the first value of the set (=1);
• Last - returns the last value of the set (=3) .

Examples: Let's assume that we have 2 records in the folder with ID=7. The records use the form with ID=9 and
have the Price field.

The Price field contains the following values: 3 and 4.

folMathOp(7,9,|Price|, |Sum|), returns 3+4=7;

folMathOp(7,9,|Price|, |SumOfSquares|), returns 3*3+4*4=9+16=25;

folMathOp(7,9,|Price|, |SimpleAverage|), returns (3+4)/2=3.5;

folMathOp(7,9,|Price|, |Quantity|), returns 2.

...RecN Functions

RecN functions are a particular case of the MathOp functions that return the number of records in the selection:

folRecN, mmrRecN, setRecN, queRecN, repRecN, subRecN, cexRecN

155
FORMATTING DATA
USING FORMATTING
Formatting determines in what way available data will be presented. For example, the number 1499.95 may be
presented as $1'499.95 or as ~1500. Or, the name of a person may be displayed as Gomer J. Simpson or G. Simpson.
Formatting is responsible for that.

Formatting is also used to work with text lines (transform the text to the upper case, replace a part of a line, get first
N characters and so on).

Formatting can be used in the following cases:

• For records fields of the type date, time, numerical, mathematical.


• At printing fields values, exporting them to the text, html and so on.
• In scripts and text formulas, for displaying/transforming the values of variables and fields.

Formatting is described with the help of the formatting string. The first four letters of the formatting string describe
the type of formatting that we use (text/math/date/time/rset/bool); the rest of the string is formatting itself, for
example:

• Formatting string "date dd mmmm yy" will return a date in the form : "16 April 05".
• Formatting string "text LEFT10;UCASE" will return first 10 characters of the text in the upper case.

In case we need to specify formatting for fields, it is possible to use a wizard by clicking ..., to the right of the field
for entering the formatting string:

In case we need to format the value of a field or of a variable displayed in a text formula, we should separate it from
the name of a field or a variable it with the "^" character. For example:

• [$order_date^date Y-m-d]
• [$name^text UCASE;WORD0;]
• [total^math ###'###0.00]
• [vip^bool yes/no]

There are on the whole 6 types of different formatting variants depending on the type of an initial value that are
described in separate sections:

• Numbers - determines how figures should be displayed (the number of characters after a comma, a group
separator and so on);
• Date - determines how dates should be displayed;
• Time - determines how time should be displayed;
• Boolean (bool) - allows displaying different text depending on the boolean value;
• Text - allows performing different operations with the text (replacing a part of the text, transforming to the
upper case, encrypting and so on);
• Recordset (rset) - is used to get a value of records fields stored in a variable of the RecordSet type.

156
FORMATTING NUMBERS
This format is used for formatting digits.

Format string example: math ###-#0,00

• "-" - means a symbol used to separate groups;


• "," - means a symbol used to separate decimal part;
• Number of "#" means the number of digits in a group;
• Number of "0" means the number of digits after and before decimal. You can use "*" to view all digits
after decimal.
• If you specify |NO_ZERO| in the format text box, and the output value is a zero, no value will be shown.

Examples:

Test String Format String Result


1234567,89 math ###'#0.00 1'234'567.89
1234567,89 math ### #0.0 1 234 567.9
1234567,89 math $###,#0 $1,234,568
1234567,89 math #0,00 EUR 1234567,89 EUR
1,2 math #00,00 01,20
1,2 math #000,00 001,20
0 math #0|NO_ZERO|

Boolean Format

This format is used for formatting Boolean values (the values that can only be true or false). False means an empty
string or 0, true means any string or number other than zero.

Format string example: bool TrueText/FalseText

• TrueText will be printed if the value is true


• FalseText will be printed if the value is false.

Examples:

Test String Format String Result


"1" bool Yes/No "Yes"
"0" bool Yes/No "No"
"230" bool Yes/No "Yes"
"" bool Yes/No "No"
"false" bool Yes/ ""
"Hello World" bool Text "Text"
"" bool Text ""

157
FORMATTING DATE AND TIME
Basic Information

To learn more about how and where you can use formatting, see the Using Formatting section.

Date Format

This format is used for formatting dates.

Format string example: date dd-mm-yy

• m - numeric representation of a month, without leading zeros (1, 2, 12);


• mm - numeric representation of a month, with leading zeros (01, 02, 12);
• mmm - short textual representation of a month, three letters (Jan, Feb, Dec);
• mmmm - long textual representation of a month (January, February, December);
• d - day of the month without leading zeros (1, 2, 24);
• dd - day of the month with leading zeros (01, 02, 24);
• ddd - textual representation of a day, three letters (Mon, Tue, Sun);
• dddd - textual representation of a day (Monday, Tuesday, Sunday);
• yy - year, 2 characters (99, 00, 04);
• yyyy - year, 4 characters (1999, 2000, 2004).

Examples:

Test String Format String Result


16 April 2005 date yyyy-mm-dd 2005-04-16
16 April 2005 date dd mmmm 'yy 16 April '05
16 April 2005 date dd mmm yyyy (dddd) 16 Apr 2005 (Sunday)

Time Format

This format is used for formatting time.

Format string example: time hh:mm:ss AMPM

• h - hour without leading zeros (2, 11);


• hh - hour with leading zeros (02, 11);
• m - minute without leading zeros (2, 59);
• mm - minute with leading zeros (02, 59);
• s - second without leading zeros (2, 55);
• ss - second with leading zeros;(02, 55);
• Use the AMPM string to show time in the AmPm format.

Examples:

Test String Format String Result


Test String Format String Result
18:30:45 time hh:mm:ss 18:30:45
18:30:45 time hh:mm:ss AMPM 06:30:45 PM

158
FORMATTING TEXT
A formatting string is a set of flags separated with ";" that are successively applied to the initial value. For example,
the next string will return the first word of the text in the upper case: text WORD0;UCASE;. See below more
complicated examples.

List of Text Format Flags

In the given examples the string "Hello World!!!" is used as a text string by default.

Example Format
Flag Name Description Result
String

Main operations
UCASE Convert text to upper case text UCASE; HELLO WORLD!!!
LCASE Convert text to lower case text LCASE; hello world!!!
TRIM Delete leading spaces from the text text TRIM; Hello World!!!
Transform all first letters of word to
CAPI text LCASE;CAPI; Hello World!!!
the lower case

Getting different parts of text


Show only the first N symbols (e.g. text LEFT3; HEL
LEFT(N)
LEFT3) text LEFT7; HELLO W
Show only the last N symbols (e.g. text RIGHT1; !
RIGHT(N)
RIGHT5) text RIGHT6; rld!!!
text SYMB0; H
SYMB(N)* Show the N symbol of the text; text SYMB1; e
text SYMB6;SYMB7; Wo
text WORD0; Hello
WORD(N)* Show the N word of the text
text WORD1; World
text LINE0; Hello World!!!
LINE(N)* Show the N line of the text
text LINE1; -

Search and replace


Return text beginning with the first text FROMll; o World!!!
FROMstr
entry of the str text FROMWorld; !!!
Return text before the first entry of text UPTOll; He
UPTOstr
the str text UPTOWorld Hello
text REPMl->X;
HeXXo WorXd...
REPMfind- Replace all find entries in the string text REPMWorld->;
Hello !!!
>replace with the specified replace. text REPMHello-
Welcome World!!!
>Welcome;
REPOfind- Replace the first find entry in the
text REPOl->X; HeXlo World!!!
>replace string with the specified replace.
Remove all html tags from the text
NOTAGS text NOTAGS; Hello World!!!
(<a>,</b>, etc)

Encrypting
CODE(N) Encrypt string with the XOR text CODE2; Jgnnm"Umpnf###

159
method. N - encryption offset. The
given encrypting is symmetric, that text CODE3; Kfool#Tlqog"""
is, if we use it twise, we will get the text CODE3;CODE3; Hello World!!!
initial text.
text MD5; 236BF30C70DC03F6
MD5 Returns MD5 of a hash string.
9175F030AFBE38F3

Bringing lines to the same length


The text "12.99" is used as an example. The given formatting is used for displaying data in the text format
with a fixed data length.
Adding zeros at the beginning of the
text LZRO10; 0000012.99
LZRO(N) text (leading zeros) for the length of
text LZRO6; 012.99
the text to be equal to N.
Adding spaces at the beginning of
text LSPC10; _____12.99
LSPC(N) the text (leading spaces) for the
text LSPC6; _12.99
length of the text to be equal to N.
Adding spaces at the end of the text
text FSPC10; 12.99_____
FSPC(N) for the length of the text to be equal
text FSPC6; 12.99_
to N.

Miscellaneous
In case the initial string is a file
path, the given command will return
text FLDR; c:\MyDocs\
FLDR a folder in which the file is located.
text FLDR;RIGHT-1; c:\MyDocs
Let's take c:\MyDocs\Doc1.doc as
an example.
In case the initial string is a file
path, the given command will return
FILE a file name. Let's take text FLDR; Doc1.doc
c:\MyDocs\Doc1.doc as an
example.
Deletes the last word from the text
(everything after the last space).
TRIMW text TRIMW; Big green
Let's take Big green apple as an
example.
Deletes the last unfinished sentence
from the text (everything after the
TRIMS last character separating sentences). text TRIMS; Big green apple.
Let's take Big green apple. Very
tasty as an example.

*When you use SYMB, WORD and LINE, a zero N value stands for the first character, first word and line
respectively.

160
Examples of combining flags

Let's draw examples of using text formatting in text formuals. Assume that we have the [$a] variable that we
process.

[$a] Value Text Formula Result


Hello World!!! [$a^text UCASE] HELLO WORLD!!!
Hello World!!! [$a^text UCASE;WORD0;] HELLO
Brining the first and the second name to the same view
john bull from UK [$a^text WORD1;CAPI] Bull
[$a^text TRIM;LEFT1;UCASE].
john bull from UK J. Bull
[$a^text WORD1;CAPI]
[$a^text TRIM;LEFT1;UCASE].
THOMAS ANDERSON T. Anderson
[$a^text WORD1;CAPI]
Retrieving a country
[$a^text
john bull from UK uk
FROMfrom;WORD0;LCASE]
[$a^text
Tom from Australia and John australia
FROMfrom;WORD0;LCASE]

161
FORMATTING RECORDSET VARIABLES
To learn more about how and where you can use formatting, see the Using Formatting section.

Recordset format is used for printing records contained in a variable of the recordset type as text. Such variable can
be created, for instance, with a query or, for instance, in a many-to-many relational field. This format appears as a
list of fields, data from which is to be displayed. Suppose, we have the [$recs] variable that contains 3 records with
the following field values:

# Date Title Quantity Total


Record 1: 2006-07-14 Apple 5 15
Record 2: 2006-07-16 Tomato 10 20
Record 2: 2006-07-19 Juice 4 16

Let's show how they will appear with different recordset formattings:

Test Text Formula Result


[$recs^rset |Title|, ] Juice, Tomato, Apple
[$recs^rset |Title| - $|Total|; ] Juice - $16; Tomato - $20; Apple - $15
[$recs^rset |Date|: |Title| - $|Total|[br]] 2006-07-14: Juice - $16
([br] - means line BReak) 2006-07-14: Tomato - $20
2006-07-14: Apple - $15
[$recs^rset |Title|, Quantity=|Quantity|;[br]] Juice, Quantity=4;
Tomato, Quantity=10;
Apple, Quantity=5
[$recs^rset "|Title|", "|Quantity|"[br]]" "Juice", "4"
"Tomato", "10"
"Apple", "5"

Please note that in the last example there is an additional quote before the tag closure. This is necessary since the
delimiter (in this case, the "[br]) is not to be placed.

Thus, the recordset format is the foundation for outputting record set values.

For performing operations over records in a recordset variable, use the cycle For Each Record From Recordset.

162
TIMERS
Timers are used to execute scripts automatically in the specified moment or at regular intervals.

Creating and Editing Timers

Use the Design DB > Edit Timers... menu command to open the timers editor window:

The left part of this window contains a list of timers for the current database. The right window part contains
information about the selected timer.

Use the buttons at the top of the list to:

• Add Timer - create a new timer;


• Remove Timer - delete the selected timer.

All timers work independently. Active timers are highlighted in bold in the list.

The timers will start working when you close the timer editor.

Timer properties

• Name - timer name. It doesn't influence the work of the timer.


• Script - by this button you can modify a script that will be executed by the timer. To learn more about
creating scripts, see the Script Designer section.
• Period - on this tab you can specify the period of time for the script to be executed. The following variants
are possible:
o On database startup - the specified script will be executed right after the database is opened.
o On database closing - the specified script will be executed when the user tries to close the
database. If the predefined variable value is set to 1 in the script, the database closing will be
cancelled.
o Every (seconds) - the script will be executed every N seconds. The minimum possible interval is
5 seconds.
o Every week - the script will be executed on specified week days at the selected time.
o Every month - the script will be executed monthly at the selected time.
• Enabled - select this check box to enable the timer.
• On Background - if this check is not selected, the script for the timer will be performed only in case you
are working in the software. If the program window is minimized, for example, and this check box is not
selected, the timer action will not be performed.
• Run Only for the groups - this option allows you to specify user groups, for which this timer will work.

163
CREATING HTML FRAMES
This program allows using a web-window instead of the regular controls:

In this picture, you can see that, instead of the standard folder list and the folder contents, the window displays a
Web page specified in the html code. Besides the regular HTML objects (text, links, tables, images, flash, etc.), you
can call User Functions to integrate the Web page with a database. For example, by double-clicking a link you can
run a query, print a report, run a script, etc for some record.

In the current version, you can define the Web content for the following objects:

• Folder list. Select the View > Advanced menu item.


• Folder content replacement. Select the HTML Content property in folder properties.

EDITING HTML CONTENT


It is recommended that you use a special Web-page editing program for creating an html page for your database.
Once the Web page is created, copy the code between the <body> and </body> tags to the html-content editor
window to add it to the database:

Close the editor, and you will see that the Web page you just created appears instead of the content of the folder:

To make the HTML interactive, use Text Formula Editor. With this editor, you can insert values of database
variables, call of user functions, formulas, constants, etc to the content. Here we are going to take a look only at the
insertion of a user function call in the code. To learn more about the other operations, please see the Text Formula
Editor section.

164
ADDING USER FUNCTION TO HTML CONTENT
Before adding a User Function call, we will need to create it with Script Designer. Suppose we have a user function
with the Run Report name and a single parameter - report_name. To insert it into the code, click the HTML UF
Link... button:

In the displayed window select the user function you have just created and the parameter value (e.g., customers).
The following text will be generated:

<!Run Report {customers}!>Link Text</a>

Replace the Link Text with the text to appear in the user function call link; for example, Checked-In customers. The
call of a user function must be completed with the </a> tag. So, our html code now looks as follows:

In the program, the Web page will appear as follows:

Clicking the link will call Run Report with the customers parameter.

165
TOOLBAR EDITOR
Unlike other programs, Brilliant Database doesn't provide a fixed set of buttons and menus for the toolbar. Here you
can create a button or a menu with any icon, hot key and script. Script is an event that happens on clicking the
button or on selecting the menu option.

Location

Select the Design DB > Edit Toolbar menu item to open the toolbar editor window:

Alternatively, you may right-click the toolbar:

Besides the main toolbar, you can also create individual toolbars for each folder and query results:

Toolbar Editor Interface

The left part of this window (1) contains a list of buttons and menus. The right window part (2, 3) contains controls
to set the selected toolbar item:

Use the buttons at the top of the list to:

• New - add a new button, separator or menu to the toolbar;


• Delete - delete the selected toolbar item;
• Up arrow icon - move the selected toolbar item to the left;
• Down arrow icon - move the selected toolbar item to the right.

Button Script Frame (3)

Use the Modify Script... button to set the script to be executed when clicking the button.

166
Button Appearance Frame (2)

Type Property

This property defines the appearance of the toolbar item:

• Button - displays an item as a regular button:

• Sub-Menu - displays an item as a drop-down menu item that is opened by left-clicking the button. This
kind of item should be positioned after a regular button. This will add a drop-down arrow icon to the
regular button. The following pictures illustrate the correct menu layout:

• Separator - adds a separator displayed as a vertical line when positioned between two buttons, and as a
horizontal line when positioned between two menu items:

Caption Property

This property sets the text of a button or menu item.

Hot Key Property

Allows setting the key combination to execute the selected item action (see below). One-key hot keys are not
recommended to use to avoid accidental keystrokes.

Icon Property

Assigns an icon to the button. To change the button icon, click the Change button.

Pop-up Text Property

Defines a tooltip that will pop up when the pointer is placed over the selected item:

167
TABLE STYLE EDITOR
Table Style Editor is an easy-to-use tool that allows you to customize the appearance of records in tables. Tables
can be used in the following ways:

• When displaying records in a folder (use the Folder > View > Appearance... menu command);
• When displaying query results;
• When displaying a list of related records in the many-to-many relational field (in Form Editor select a
needed element and on the Individual Properties tab click Configure Appearance...) ;
• When printing a many-to-many relational field (in Report Style Editor select a needed element and on the
Individual Properties tab and click Configure Appearance...).

Table Styles examples:

• Changing the default color skin:

• Displaying a multiline text using different fonts, displaying the contents of an image field in a table:

Table Style Editor Interface


The upper pane consists of 4 tabs:

• Columns - on this tab you can select columns to be displayed and customize their properties (positioning,
text font, colors);
• Rows - this tab allows you to customize the properties of the table rows (height, style);
• Header - this tab allows you to customize the properties of the table header;
• Sort and Group - using this tab you can set the order of data sorting and grouping (this tab is available for
certain tables only).

In the bottom pane of the window there is a test table that is used as a table style preview.

168
Columns Tab

The left pane of the Columns tab contains the list of columns available in the table. In addition to the columns
representing the data of the record fields, a number of special columns are also available:

• RECORD ICON - in this column an icon indicating the record type is displayed. The icon can be modified
in the form properties in Form Editor;
• RECORD TITLE - this column contains the header of the record. One of the record fields is used as its
header. This column is very useful when displaying records of different types in one table. For example, if
one folder contains the list of authors and the list of books, the RECORD TITLE column will contain the
titles of the books and the names of the authors. Such header field can be defined by selecting the Title
Field option in the Record menu.
• FILES COUNT - this column contains the number of attachments for the record;
• LINKS COUNT - this column contains the number of links to other records for the record;
• FOUND IN STRING - this column contains the part of the text, in which the search string was found. To
learn more, see the Find Records section.
• RECORD FOLDER - this column contains the name of the folder that contains the current record;

The right part of the window can be used to edit the selected column:

• Font - the font used in the column;


• Text Alignment - text alignment in the column (left, right or center);
• Back/Fore color - background color and text color for the column. By clicking the "<=>" button, you can
specify additional colors that will be applied depending on the field values. For example, you can highlight
goods that are running out or non-paid orders with red. Learn more...
• Alternative Title - the header title of the selected field. If empty, the field name will be used.
• Position - these buttons help you change the position of the column within the table;
• Lock the column - if this check box is selected, you will be able to hide or display this column only using
Table Style Editor (that is available only for "administrators" user group). That is, for other database users,
this column will not be available from the "Columns" menu.

169
Rows Tab

• Allow to edit data directly in grid cells - this option makes the grid cells editable, so you can change
record's fields using the grid:

You can also change this option for all table styles in your database in once from the "View->Advanced..."
menu item.
• Fit last column - clear this check box if you don't want the last column to be fitted to the table width:

• Row Height - defines the height of a row (record) in the table;


• Selection Back/Fore Color - color of the back/foreground for the selection of the current record;
• Gradient - select this check box to fill the record gradient when selected.

Header Tab

• Draw Header - clear this check box to hide the table header;
• Header Font - defines the font of the header;
• Header Back/Fore Color - defines the background color of the header and the font color;
• Hide header if no records in the table - if you mark this flag the header will not be displayed if the table
contains no records.

170
Background Tab

• Use custom color - this option allows to replace the default grey background color with another:

• Use custom picture- this option allows to use any picture as a table background;
• Rows transparency - use the transparecy option to show the table backround under records in the table:

• Draw Grid - clear the check box to hide the grid of the table;
• Grid Color - click this button to change the grid color;
• 3D Grid Style - select this check box to apply the 3D grid style.

171
Sort and Group Tab

• Sort records by - this element is used to specify the fields, by which the table records will be sorted;
• Group records by - these elements can be used to group data in a table by fields. Grouping is available for
the many-to-many relational fields and query results only.

To make sure the grouping works right, records are to be sorted by the same fields as the grouping is done by;
otherwise, you can receive several groups with the same name.

Using the buttons at the bottom of the window, you can customize the color, font, group header and footer and
select whether the groups are to be collapsed by default or not:

By clicking the Summary button to the right of the field by which records are being grouped, you can create
displaying subtotals for each group using the wizard:

• Comments - select the text to be displayed before the calculated value;


• Field - select the field, by which the calculation is to be done;
• Operation - select what is to be calculated by this field (total, average, max/min value, value count).

The line with the calculated data will appear below all records in the group (see the picture above).

172
TEXT FORMULAS
Text Formula is a text string consisting of various elements such as record field values, formulas, variables, system
values, etc.

A Text Formula value is calculated directly before it is used. For example, the following Text Formula:

Today: [$_Date], when exported into a text document will be replaced with:

Today: 2005-10-10 (if today is October 10, 2005).

Text Formulas can be used in the following cases:

• In Scripts, to set variables and text parameters (for example, message text or field value).
• In Custom Export Editor, for creating export templates; in fact, an export template is one big text formula.
• In Report Styles, to output specific text.
• Many other places. To find out if the text will be recognized as a formula, simply start typing the formula.
If the tags [Tag Text] are highlighted in blue, you can use elements of a text formula here:

For convenient editing of text formulas, the program features Text formula editor that can be accessed by clicking
the "..." button on the right of the field to be edited:

Note: starting from version 5.0 the text formula format was changed. The old format that uses the # symbol is
supported but not recommended.

Text Formula Editor

You can edit text manually or use the buttons on the left to insert text formula elements quickly:

• Variables - allows inserting variables into the text.


In the text it looks as follows: [$Variable Name], for example: [$total].
• Fields - allows inserting fields of record into the text. This button can be unavailable if you can't use a text
formula for one record type.
In the text it looks as follows: [Field Name], for example: [Name].
• Formula... - allows inserting a mathematical formula. Note: a formula is inserted into the text as ready-
made, i.e., all text identifiers are replaced with the corresponding number IDs.
In the text is looks as follows: [%Formula], for example: [%5+sin(f(14))].
• System Value... - allows inserting a system value into the text. The systems values can be:
o Date - the current date;

173
o Time - the current time;
o User Name - the name of the user working with the database. This value should be used when
several people are working with the database via network. The name of the user for the client
corresponds to the name under which the user has connected to the database; the name of the user
for the server is entered at the moment of sharing the database. To learn more, see the Network
section.
o Database Path - a path to the current database, for example c:\databases\mydb.bbd;
o Cur Folder Name - the name of the current folder.

In the text it looks as follows: [$_Value Name], for example: [$_Date].

• User Input - is available only for text formulas used in rules. Before checking the rule, the user is
instructed to enter the values of the parameters. The text inside the tag is used as the window caption.
In the text it looks as follows: [?Comment String], for example: [?Enter date:];.

Special Characters

Sometimes we need to use some special characters like "[","]" in texts, and the program attempts to interpret them as
texts. If that's the case, use the following substitutions:

• Replace [ with :{:


• Replace ] with :}:
• Replace ; with :':

Formatting Data

To set formatting for the data returned by the text formula elements, you have to add another ^ symbol and indicate
the formatting string after it. For example (for variables):

• [Cost^math #0.00], output: 123.00 (2 digits after comma).


• [Name^text UCASE], output: THOMAS ANDERSON (all capitalized).
• [Birthday^date dd.mm.yy], output: 16.04.1983 (the date format).

To use the Formatting wizard, click a bracketed text formula element, then click the Set Format... button. To learn
more, see the Formatting Data section.

174
COLOR RULES
Using "Color Rules", you can specify different color schemes depending on values of fields for tables and reports.
For example, you can highlight non-paid orders with red, and paid orders - with green.

To open the window with color rules settings, click the "<=>" button on the right of the button for specifying the
main color:

If there are rules that are already specified for the field, their number will be displayed on the button:

CONFIGURATION WINDOW

On the whole, you can set up to 5 different rules. Rules are checked top-down. If a rule is executed, the defined
colors are applied to the elements and all the other rules are skipped.

The first color column defines the background color, the second one - the text color. To delete a rule, click the "X"
button.

175
RULE WIZARD
Rules can be used in the following two cases:

• To describe queries in Query Editor;


• To describe conditions (if rules then ...) in Script Designer.
• To set rules for elements visibility editable in Form Editor.

In the conditions you can use text fields, mathematical formulas, variables and User Input.

INTERFACE

The window for entering rules comprises three parts:

• Field to check - in this area you can select the field, to which the rule is applied (the first rule argument).
Also you can choose Formula... or Variable as the first argument. To set a formula or select a variable,
click the "..." button that will appear right after the field.
• Rule To use - the rule itself (More than, Equal, Begins with, and so on).
• Compare with - defines the second argument for the rule. Depending on the type of the second argument,
the bottom part of the screen may change.

TYPES OF THE SECOND ARGUMENT


The second argument can be of the following types:

Constant

A constant value. When the field is selected, the window for entering this value will appear. Use Constant if you
know the value to compare with, beforehand.

User Input

Before accomplishing a request, the user will be offered to enter a value of the second argument for the rule. When
the field is selected, the window for entering a message text will appear. For example, the user searching for an item
in the database may enter the following text: "Enter the first letters of the author's name:". In this case when the
query is executed, the user will see the following dialog:

Moreover, when creating a text button with the given query as an action, the text provided in the text button will be
automatically sent to the query as a User Input value (see the example). Also you can use the User Input type to pass
a value from queMathOp or queRecN formula. If you select the variable type, you will be offered to select the Skip

176
this rule if empty value is entered option. In this case, if you enter no variable, the rule will be skipped. It is
necessary if you're creating multiple search.

Formula

Allows using a mathematical formula as the second argument. In the formula you can use both the fields of the
current record, and variables and values of the other records. To learn more, see the Formula Editor section.

Text Formula

In this case the second argument will be in the form of a compound text string. The string can include field values,
variables, system values (such as the current date or the name of the user working with the database). To learn more,
see the Text Formulas section.

Field of record being checked

In this case the field of the same record (the one being checked) can be specified as the second argument. This, for
example, will help to get a list of the book that were purchased in the year they were published: Publication Date =
Acquisition Date.

Field of record being selected

In this case the field of the record, which was selected at the moment of requesting, can be specified as the second
argument. For example, the user can create a query that will return a list of the books published earlier than the
selected one.

Field of custom record

In this case the user can specify a field of any specific record as the second argument. For example, if there is a
record about quantity of money available, one can get a list of the books that can be purchased having the given
sum.

177
SELECT RECORDS DIALOG PROPERTIES
The window for selecting records usually looks as follows:

However, you can cofigure it by clicking the Record(s) Input Config button. This will open the window for setting
up the record selection properties.

GENERAL TAB

• Record TypeType of records (form) to select;


• Filter By Rules - this button allows you to specify a filter that will restrict records to be selected. For
example, if we select goods to order, we can specify that their number at the storehouse should be greater
than 0.
• Top level folder - by default user can choose any folder to select records:

However, using this option we can set a folder that will be used as a root folder ("Tests" on the screenshot):

• Default folder - a folder selected by default. This folder must be in the "Top level folder".
• Hide tree of folders - when this check box is selected, the tree of folders on the left will not be displayed.
The record can be selected only from the folder that was selected as the Default Folder.
• Don't allow user to create new records - when this check box is selected, the button of quick record
creation directly from the record selection window will be hidden. If the user clicks this button for creating
a record, the user will be prompted to enter its heading only.

178
VISUAL TAB

• Use custom table style - this option allows to setup a different table style for the record list;
• Specify window width and height - click thi checkbox to setup custom width and height for the dialog;
• Set custom caption - changes the window title:

• Add a label... - entered text will be displayed in the window for selecting record(s):

ADDITIONAL TAB

Show text box for quick search and select - when this check box is selected, a text window will open above the
record selection window. The selected query will be executed when the text is entered into the field:

This text field acts in the same way as the Text Button on the form. You enter the text, press Enter, and the entered
text will be sent to the query as the first User Input value.

179
CREATING EXECUTABLE APPLICATIONS
BASIC INFORMATION
Brilliant Database Ultimate Edition allows you to create full-fledged Windows XP/Vista applications based on your
databases. You will be able to sell your program, present it, install on an unlimited number of computers royalty-
free.

Created programs will have your logos, interface, graphics and even texts. You can disable all options that will not
be needed by end users, and leave only necessary buttons and menus.

The Ultimate Edition will automatically pack your product into a distribution package for it to be easily installed on
user computers; that is, Ultimate will create a full-featured Windows application including:

• Setup wizard
• The software itself
• Uninstall module

To quickly create your own program:

1. Either create a new database using Brilliant Database general tools (Form Editor, Report Style Editor, etc),
or open an existing database;
2. Open the Application Project Settings window (Design!->Application Project Setting). The program will
automatically create an Application project folder. This folder contains all files responsible both for
appearance (logotypes, texts, etc.), and for functionality of the compiled application.
3. In the displayed properties window of the EXE project specify the program name and select its type. You
can also set a variety of other parameters here (see below).
4. Click the Make "MyDBApp.exe" button to create an installation distributive with yor program.
5. Congratulations! You have created a new product without learning any programming or writing a line of
code.

180
REVIEWING EXE PROJECT PROPERTIES
To get access to the window with the EXE project settings, select Design!-> Application Project Setting. If the
project folder is not created yet, it will be created automatically and you will see the window with your application
settings:

Properties of a created program are presented on 7 tabs:

• General. On this tab main parameters of a created program, its name and type are specified.
• Features and Menus. On this tab you can select what features should be included in a created program. For
example, you can prohibit working by the network or disable all menus except the File menu. You can also
create your own My Menu Item in the Main menu by this tab.
• Graphics. On this tab you can set an icon, logo and other graphic elements of your program.
• Main Texts. On this tab you can select the program language and change all text resources, For example,
replace the "Find Records" with "Locate my documents" menu if you are creating a program for keeping
records on documents.
• Setup Texts. On this tab you can change the strings displayed to the user at installing the program. For
example, "This will install `My application v1.2`. Continue?"
• Setup Options. On this tab, you can change setup options for the created program (add text of the License
Agreement, select to create the program icon on the Desktop or not and so on).
• Protection. On this tab you can protect your database from unauthorized copying and changing. Learn more
about protecting programs...

To create an installation distributive with your program, click the Make "MyDBApp.exe button at the bottom part
of the window.

181
GENERAL TAB

Application Type - the type of an application determines what type of program you want to get. The type is defined
by the ability of the user to create and edit databases. There are 5 types possible:

• Full-Featured Database Application - end user can create new databases, open existing databases and
work with them. For example, this can be inventory software, documents database and so on. The end user
will have a possibility to work with several databases at the same time.
• One File Database Application - after running the application, the database will be opened automatically.
End user can work only with this database. End user will have no rights to create new databases or open
other databases. Use this type if the end user should have an ability to work with only one database.
• WorkPlace Application - end user will be able to open existing databases and work with them. End user
will not be able to create new database files. If you are creating such application, you will have to provide a
file with a database to the user as it is not included into the distributive. This may be useful if different
users need databases with different structure/formulas/reports and so on.
• Database Viewer - end user will be able only to open existing databases for viewing. That is, this is the
same as WorkPlace Application but without a possibility to bring changes in the database.
• Information Database - after running the application, the database will be opened automatically. End user
will not be able to modify database. It's optimal if you want to create a catalog of your products,
informational database, etc.

Software Title

Full program name - is used in the title of the main application window, in different dialog windows, in the register
of installed Microsoft Windows programs (Control Panel->Add/Remove Programs) and so on.

We recommend you to specify the version of the program in the full program name, for example "The Best Catalog
v2.5" or "Warehouse Book 2008".

Company Name

Name of the company that will be specified as the author of the created product (in the distributive properties, in the
"About..." window of the program and in the program title). The name of the company is determined on the basis of
the registration key that you accept after purchasing a license for Brilliant Database Ultimate. That is, if, for
example, Brilliant Database Ultimate is registered for "XYZ Company Inc", "XYZ Company Inc" will be specified
as the author in the created programs.

Software UID

A unique numeric identifier of the created program. It is made up automatically at creation of the application
project. To learn more about its purpose and use, see the Protecting created programs section.

Build #

The build number (internal version). It is increased by one every time you compile the distributive. To learn more
about its purpose and use, see the Protecting created programs section.

182
FEATURES
To get access to setting the menu and features of your program, select the Design!->Application Project Setting
menu item and click the corresponding tab:

All options are divided into 6 sections as they are located in the main menu of the program. If you disable some
feature, it will disappear from the menu and will not be available by the standard means; though you will still be
able to execute it from the script. For example, if you disable the "Record->Delete Record(s)" feature, in the
compiled program:

• The "Record->Delete Record(s)" menu item will disappear.


• Selected records will not be deleted from the active list of records when the Delete key is pressed.
• But if there is the "Delete Record(s)" action in some script, it will be executed.

Therefore, you can fully control and change the user interface. For example, you want that the user should not have
a possibility to randomly create folders and records, and should be able to print only specific records. To do this,
disable the Add and Print menus and create on the toolbar or a form buttons performing analogous actions, but at
that fully controlled by your scripts and conditions; or visible only to specific groups of users.

At disabling all menus, the interface of your program can look very compact:

Besides, in this section, you can create your own item in the main menu of the program (the last item My Menu).
Learn more....

List of features

• Main Menus - In this section you can disable any of the program main menus (Add, Folder, Record,
Queries, Help):

• "File" Menu - Options available from the "File" menu (work by the network, users, export/import and so
on);
• "Record" Menu - Operations available for records;
• "Folder" Menu - Operations available for folders;
• "Queries" Menu - Setting up options of work with queries;
• "Help" Menu - Setting the "Help" menu. The path to the help file and information about the program can
be specified in the "Main Text" section.

183
MY MENU
In this section, you can add your own menu in the main menu. The added menu will be displayed right after the
"File" menu, for example:

Creating Menu

To create your own menu, open the project settings and on the "Features" tab, select the last item - "My Menu":

• Menu Name - defines the name of the menu;


• Show Menu - select this check box for the menu to become visible;
• Add Item - adds an item to the submenu. On clicking this button you should enter the submenu name and
define a script that will be executed when this submenu is selected. To create a separator, enter the dash
character (-) as a name.
• Up/Down - moves the current menu up or down in the list.

The created menu is a feature of the created program, not the database feature (in contrast to the toolbar, for
example). That is, if you open the database with the Brilliant Database Pro program, you will not see the menu in it.

Please keep in mind that you can also create drop-down menus on the Toolbar:

184
ICONS AND LOGOS
To get access to setting logos and icons of the program, open the properties window of the SDK project
(Designers+SDK->Exe Database Project Settings) and click the corresponding tab:

It is the most convenient to edit graphic files of the program using specific editors (Adobe Photoshop, Paint, etc) or
order them from professional designers. All files are located in the project folder with the ".sdk" extention that you
can open y clicking the Explore Exe Project Folder button.

Intro Screen (logo.bmp)

This image is used as a background of the About and Intro windows.

The size is 500x250 pixels. At the bottom right part of the window it is necessary to leave a white rectangular for
text information, for example:

Wizard Screen Logo (wiz.bmp)

The given picture is displayed in the left part of different dialog windows and wizards. The size is 130x280 pixels. It
is advisable to make edges of an image white for them to harmoniously fit into the program interface.

Icons

The program icon is a company's image and its logo - this is what the user associates the program with.

The format of an icon differs greatly from a usual graphic file - that is why it is better to order it from professionals
or use special icon editors. In short, when creating an icon, it is necessary to remember that:

• An icon file contains a number of graphic files with an image of an icon of different sizes. Usually it is
16x16 for a window title and the Start menu, 32x32, 48x48 and 64x64 for displaying on a desktop.
• Icons, in contrast to usual images, can contain transparent areas (pixels) for nicer displaying of an image on
the desktop. For example:

185
Setup Icon (setupicon.ico)

This icon is used for the program distributive and usually looks in a traditional way:

Setup Icon (setupicon.ico)

The main program icon, is used in the window title, in the Start menu, as an icon on the desktop and so on:

Other graphics

ll other graphics used in the program is a property of the database, for example, for editing icons on the toolbar,
open Toolbar Editor.

MAIN TEXTS
In this section, you can change all texts used in the program (message texts, labels of menu, help file and so on):

About->More Info...

This text will be displayed on clicking the "Additional information..." button located in the "About" window of the
compiled program:

If the text is not specified, the button will not be displayed.

Visit Home Page URL

In this window you should enter the URL of the web page that should be opened when the user selects the "Visit
Home Page (www)" item from the Help menu. This item can be disabled on the Features tab.

Help File

186
This item allows you to select the Help file that should be used in the program. The Help file can have any format,
but we recommend using the standard ones, for example, Adobe Acrobat (pdf), Plain Text (txt), HTML (htm),
Microsoft Word (doc), Help File (chm/hlp).

The file selected with the help of the "Change..." button will be copied to the project folder and renamed in Help.
This file will be included into the project.

If you do not want to include the Help file into the program, disable the corresponding menu item on the Features
tab in the "Help" section.

Powered By

Using this menu, you can hide information about the engine of your program in the About window.

Languages

All standard texts used in the program are stored in the main_[lang].txt file. For example, for English it will be
main_eng.txt file; for Russian - main_rus.txt file.

To select the file and language that you want to use, click the "Set language..." button.

To edit the language file, click the "Edit textual resource file..." button.

Spell-check dictionary

To include your own spell-check fictionary file (dict_[lng].txt), just copy it to the project folder.

187
SETUP OPTIONS

Brilliant Database Ultimate creates not an empty program, but a full-featured product (distributive) ready for
immediate distribution, that includes the installation program in it. Usually the installation program:

1. Displays information about the installed program.


2. Displays the License Agreement to the user. The file of the License Agreement that will be included into
the distributive is stored in the project folder and is called "license.txt".
3. Unpacks the program files to the user's computer.
4. Creates icons on the Desktop and in the Start menu.
5. Links program files (databases) to the program itself. You can select any extension for files of your
database. However, we do not recommend using popular extensions (for example, mp3, txt, zip, doc, mdb,
xls) to avoid conflict with other applications installed on the user's computer.
6. Launches the program when the installation process is complete.

The "Setup Options" tab allows you to set up execution of these actions.

Messages displayed at installation can be edited on the "Setup Texts" tab. You can use the {app_name} tag not to
enter the program name all the time.

188
PROTECTING CREATED APPLICATION
Introduction

So you created your own program using Brilliant Database Ultimate and now it's time to think about its protection.
From what and how can you protect your program?

1. Protecting the database structure from unauthorized changing

Created with the help of the Ultimate version, the program works with databases files, the format of which is
identical to the format of files used in Brilliant Database. It is very convenient at the program development.
However, you would not like the user of the program created by you to have a possibility, having installed Brilliant
Database, to open a database file of the program and change it: for example, to correct a formula or delete a critical
field on the form. Or to see how script works inside the program.

To protect the program from such unauthorized access, Brilliant Database has a mechanism of protection from
viewing or editing its database. To enable it, open the properties window of the EXE project (Design!->Application
Project Setting) and on the last tab select the Protect modification/viewing... check box:

At that the structure of the database will be encrypted with a random key that will be written to the folder of the exe-
project (.sdk). Therefore, to open such database the user will have to have such folder, that is, nobody except the
author of the project having the .sdk folder with a key will not be able to get access to the inside of your program.

To this end, there is the number "Software UID", assigned at the moment of the project creation. It is written in the
encrypted way into the created program and into the database and used for the created program to be able to work
only with its databases.

For example, if you created 2 programs using Ultimate - XYZ Notes and XYZ Photos, the XYZ Notes will not be
able to work with the database files created by the XYZ Photos program.

2. Creating a demo-version and protecting from unauthorized copying

To provide to potential clients a possibility to view the program options and not to be afraid that it is used illegally,
usually a demo version of the program with limited functionality is created.

The easiest way to create a demo-version using Brilliant Database Ultimate is to limit the maximum number of
records in one folder. You can do this by selecting the second check box on the Protection tab in the properties
window of the exe project (see above).You can also disable some functions critical for the work of the program on
the Menu and Features tab.

189
3. Using side solutions for protection from copying

Beside a demo version, you can also create a trial version of the program limited in the number of launches or in the
period of use (for example, 30 days, after which the user will have to enter a registration key). Or to protect your
program with the HASP Security Hardware Key.

To create such kind of protection, there is a number of specialized programs and services (for example, AsProtect or
Alladin).

Creating the program protection using side products is usually carried out by one scenario:

1. Start the program for protection creating.


2. Select the main executable file of the program that should be protected. In our case, this file is located in
the exe-project folder, and is called bdb_wp_engine.exe.
3. Set the protection parameters (for example, specify the number of days during which it will be possible to
use the program without a registration key).
4. Click the Protect button (or Finish, Go and so on), and the program will change the code of the
bdb_wp_engine.exe file, adding its protection to it.
5. Now you can launch Brilliant Database Ultimate and click the Make button to build the program
distributive. A protected version of the program will be included into it.

Now, at starting the program, first the added protection module will operate, that will provide the user with an
access to the program only if all necessary conditions that you selected are met (availability of the USB-key, entered
registration key, unexpired trial period and so on).

190
APPLICATION PROJECT FOLDER
Basic Information

The Application Project Folder contains files that will be included to the distributive of your program and that
determine its outward look and functionality.

The given folder is created automatically at the first start of the Application Project Settings module and has the
".app" extension and is always located in the same place where your database is.

Application Project Folder Content

This folder contains the following items:

Files

• Icon.ico - this file will be used as an icon of your application. To learn more, see the SDK - Changing logo
and icon section.
• Setupicon.ico - file that will be used as an icon for the distributive package of your application (installer).
To learn more, see the SDK - Changing logo and icon section.
• Logo.bmp, Wiz.bmp - graphic files that will be used as a logo of your program. To learn more, see the
SDK - Changing logo and icon section.
• Main_[lng].txt - this file contains all string constants used in the program. You can edit it in
correspondence with your requirements or translate it to any other language. Learn more about
localization...
• Bdb_wp_engine.exe - the main executable file of the program. You can protect it using side software to
prevent unauthorized copying. Learn more...
• Main.dat - system files.
• Help.??? - Help file. Learn more...
• License.txt - file with the text of the License Agreement. To include the License Agreement into the
installation, select a corresponding check box on the "Setup Options" tab of the project properties.

The "myfiles" Folder

Place in this folder all files you want to include into your software (sounds, graphics, etc.). To access this folder
from a database script use the following system variable: "[$_myfiles]" E.g. if you place an "readme.doc" file into
this folder, you will be able to access it by using the "[$_myfiles]\readme.doc" path.

191
CREATING ADDONS AND INTEGRATION
This section describes how you can implement interaction of your database with third party modules, programs and
tools, and how you can create addons for Brilliant Database.

Brilliant Database provides several ways to do this:

1. You can use built-in tools to work with Microsoft Office and Internet web-pages;
2. You can create a dynamic library (dll) to add necessary functions to the program;
3. You can receive and send WM_USER, WM_COPYDATA messages with SendMessage;
4. Or you can use the Clipboard.

The first method does not require you to have any programming skills; to use methods 2, 3 and 4, you should have
some experience in any programming language for Windows, for example, Visual C++, Visual Basic, Delphi, etc.

CREATING AND USING DLLS


USING 3RD PART ADDONS (DLLS) IN BRILLIANT DATABASE
In Brilliant Database, you can connect and use functions from third party dynamic libraries (dll) if they were
arranged in the appropriate way. To do so, you should create a script and add to it the "Execute External Dll Proc"
action with the following parameters:

• DllName - file name of the connected library. If no file name extension is specified in the DllName
parameter, the default library extension .dll is appended. However, the file name string can include a
trailing point character (.) to indicate that the module name has no extension. When no path is specified, the
function searches for loaded modules whose base name matches the base name of the module to be loaded.
If the name matches, the load succeeds. Otherwise, the function searches for the file in the following
sequence:
o The directory from which the application loaded.
o The current directory.
o The 32-bit Windows system directory (by default: "C:\Windows\System32")
o The Windows directory.
o The directories that are listed in the PATH environment variable.
• ProcedureName - name of the called procedure in the library.
• ParameterA, ParameterB - string parameters passed to the procedure.

The result of the external function execution can be saved into a variable.

CREATING 3RD PARTY ADDONS (DLLS) FOR BRILLIANT DATABASE


To create additional modules for Brilliant Database, you can use any development tool, for example, Visual C++,
Visual Basic, Delphi, etc. The created module should be a usual dll. All exported functions should be declared in the
following way:

void __stdcall ProcedureName(char *ParameterA, char *ParameterB, char *ReturnValue)

Where:

• ParameterA, ParameterB - text variables passed from Brilliant Database in the standard Non-unicode
character encoding.
• ReturnValue - text buffer in which the value returned by the function should be written. The limitation for
the buffer size is 1 000 000 Bytes.

192
For example, the following simple function will display ParameterA and ParameterB in a simple message and return
a string with a random number:

void __stdcall TestMessage(char *ParA, char *ParB, char *RetValue)


{
MessageBox(NULL,ParB,ParA,1);
wsprintf(RetValue,"Hello from Dll. Random value: %i",rand());
}

If you call it from Brilliant Database with the following script:

we will see two sequential messages, the first one displayed from the dll, and the other one displayed by the script
from Brilliant Database.

Note. When creating a dll, keep in mind that the dll in Brilliant Database is connected at the first call of any function
from the given dll (LoadLibrary); when the database is closed, the dll is disconnected (FreeLibrary).

193
SENDMESSAGE, WINAPI
This section describes how you can implement interaction between Brilliant Database and a third party program
using the SendMessage WinAPI function that allows sending messages to other windows.

Brilliant Database can receive and send two types of messages:

• WM_USER - to pass two numbers of the int type (4 bytes);


• WM_COPYDATA - to pass one number of the int type (4 bytes) and a string of any length.

To use this function, you need to know the identifier of the window (HWND) that will process these messages. In
Brilliant Database this HWDN is stored in the [$_hwnd] variable.

RECEIVING MESSAGES FROM EXTERNAL PROGRAMS


When WM_USER or WM_COPYDATA messages are received, the "System->On SendMessage" script available
from the Script Editor (Design->Database Scripts...) is called.

In this script, values received in the message are stored into three variables:

• [$wparam] - WParam value, for the WM_USER message (number);


• [$lparam] - lParam value, for the WM_USER message (number);
• [$dwdata] - dwdata value from the COPYDATASTRUCT structure (number);
• [$lpdata] - lpdata value from the COPYDATASTRUCT structure (string).

For example, the following processor script will simply write sent data into the [InText] field of the current record:

The external program sending a message needs to know the HWND of a receiving window of Brilliant Database. To
get this value, use the [_$hwnd] system variable. You can pass this value to another program, for example, by
launching the program from Brilliant Database using the Open File/URL action with [$_hwnd] as a parameter.

Note. The value stored in [$_hwnd] is not the identifier of the Brilliant Database main window, but is the identifier
of a special window processing an external message. When the database is closed, this window is removed for
security purposes.

To learn how to send the WM_COPYDATA message, see MSDN web site.

194
SENDING MESSAGES TO OTHER PROGRAMS (WINDOWS)
To send a message, use the "Win SendMessage" action. Parameters:

• Target hWnd - identifier of the window (HWDN) to which a message should be sent;
• Message - sent message. There are only two variants possible - WM_USER and WM_COPYDATA;
• wParam - value written to wParam when the WM_USER message is passed (number).
• lParam/lpData
o For the WM_USER message - value written to lParam;
o For the WM_COPYDATA message - string written to lpData of the COPYDATASTRUCT
structure.

USING CLIPBOARD
Windows Clipboard provides the easiest way to exchange data between programs.

To work with the Clipboard, the [$_clipboard] system variable should be used. This variable contains the current
text stored in the Clipboard (for example, copied from MS Word with the Edit->Copy command).

You can also write your own value to this variable using scripts. The content of the Windows Clipboard will change
then, too.

195
MISCELLANEOUS
VIEW MENU
The 'View' menu is accessible from the main menu and allows you to determine the appearance of the program:

• List of Folders - determines if the list of folders should be displayed. This option is the property of the
database, not of the program. That is, this property is stored in the database itself and can be changed at
opening different databases.
• List of Query Results - determines whether a small window with results of query execution should be
displayed or not. This window is located under the list of folders. Usually it appears automatically at
execution of a query with corresponding settings for results displaying. This is a database property.
• Status Bar - determines whether the status bar at the lower part of the program window should be
displayed or not. This is a program property.
• Toolbar - determines whether the user toolbar at the upper part of the program window should be
displayed or not. This is a database property.
• Language - allows you to select the program interface language. If a necessary language is not available in
the list, you can translate the program to this language on your own. To learn more, see the Localization
section.
• Charset - allows you to select encoding in the program. It may be necessary if the standard encoding used
in Windows differs from the one with which you work in the database.
• Advanced... - this menu opens advanced settings.

196
LOCALIZATION
Brilliant Database is a multilanguage application.

You can select a necessary language from the View > Language menu.

Translating to a new language

If there isn"t a language you need in the list, you may translate the program to a necessary language on your own.
To do this:

1. Open the folder with program text (by default, "C:/Program Files/Brilliant Database/Texts");
2. Make a copy of main_eng.txt file;
3. Name it in correspondence with your language (for example, if it is Italian, main_ita.txt);
4. Open the new file main_lng.txt. In the first line specify a full name of the language to which you want to
translate the program; in the second line specify your name or nickname to determine the authorship.
5. Translate the content of the file. The names of groups in square brackets (for example, "[Menu]") should
not be translated.
6. After you have completed translation, save the file and start the program.
7. A new language will appear in the Languages menu.

You can send your translation to us to info@binarybrilliant.com for it to be added to an official distributive of our
program. Owing to this:

• Your compatriots will be able to use the program in their native language;
• When new versions of Brilliant Database are released, you will not have to translate the whole interface
anew. The only thing you will need is to translate new strings;
• You will be able to get a license for Brilliant Database free or with a discount (contact support for more
information).

197
COMMAND LINE
Command Line Options

Brilliant Database can be started with the next command line parameters:

• -user:{username}# - defines the user name, who will work with the database. If the user does not exist, the
welcome screen will be displayed;
• -password:{password}# - defines the user password;
• -share - defines that on opening the database it should be shared (so that it becomes available for work by
the network, learn more...);
• -port:{port_number} - defines over which port the database should be shared. If this parameter is not
defined, the standard port 6420 is used. Learn more...;
• -close - if this check box is selected, the program will be closed after loading the database and executing all
"On Load" Timers;
• {database_path} - path to the database to work with is always specified at the end of the command line.

Note. As user name and password can contain space characters, always end the "-user" and "-password" parameters
with character #.

Examples

BDB_Server.exe C:\Mydb.bbd

Simply opens the "C:\Mydb.bbd" database.

BDB_Server.exe -share C:\Mydb.bbd

Opens the database and makes it available for work by the network.

BDB_Server.exe -share -port:6427 C:\Mydb.bbd

Opens the database and makes it available for work by the network over port 6427.

BDB_Server.exe -user:Tom# -password:123# C:\Mydb.bbd

Opens the database with the user Tom logged on who has password 123.

BDB_Server.exe -user:Administrator# -password:zx432# -share C:\Mydb.bbd

Opens the database with Administrator logged on who has password zx432, and makes the database available for
work by the network.

BDB_Server.exe -close C:\Mydb.bbd

Opens the database, executes load timers and closes it.

198
ADVANCED VIEW SETTINGS
Select "View->Advanced..." from the main menu to open this dialog. It contains misc settings grouped on 3 tabs.

FONTS

On this tab you can change fonts for the basic elements of the main software window:

• Toolbar buttons:
• List of folders:

• Window Titles (for the selected record and folder):

• Record Tab Strip:

REPLACE TREE
Using this tab you can replace the default tree of folders with a custom html page. To know more read the "Creating
HTML Frames" section.

199
MISC SETTINGS
This tab contains different ungrouped settings:

• Open Records from "Find Records" in. This option allow to select an action that will be performed than
a user double-click a record in the "Find Records" dialog:

You can choose to:


o Open the record in a new popup window;
o Open the record in the main software window.
• Show non-editable text fields as. There are 2 variants of how to show blocked text fields in the database:
o As locked fields. A user can select and copy text, but he cannot change it:

o As greyed fields. A user cannot select or activate these fields:

• Remember vertical split rate separately for each form. This option has an effect if you use several
forms in your database and the "Vertical split" layout type for folders.
• Allow cancel in popup record edit forms. If you mark this flag you will be able to close a without saving
changes:

By default all changes in a record are saved automatically.

200
APPENDIX A. LIST OF ACTIONS
FIELDS OPERATIONS
Set field value (text)

Parameters: Field, TextFormula

This action sets the value of the Field according to the specified TextFormula.

Text Formula represents simple text that can include field values of a record, and variables.

In the script this action is displayed as: [Field] = Text Formula.

Examples of use:

• [Status] = Complete. (simple text)


• [Full Name] = Mr [First Name] [Last Name]. (merge two fields)
• [Name] = [Name^text UCASE]. (transform the text in the field to the upper case)
• [Date] = [$_date]. (set the field value according to the current date).

If a value of a field is changed with the help of this command, the "On Edit" script will not be called for the changed
field. This script is called only if a field is edited manually.

You can call this script using the Execute field's script action.

Set field value (math)

Parameters: Field, Formula

This action sets the value of Field according to the specified mathematic Formula.

In the script this action is displayed as: [Field] = Formula.

Examples of use:

• [Quantity] = [Quantity]+1. (increment the field value by one)


• [Total] = [Cost]*[Quantity]. (write into the field the product value of two other fields)
• [SinA] = Sin([$a]. (write into the field the value of the sine for the variable named "a")
• [Total] = mmrMathOp(|Items|,|Quantity|,|Sum|). (write into the field the sum by the "Quantity" field for
records from the relational "Items" field)

If a value of a field is changed with the help of this command, the "On Edit" script will not be called for the changed
field. This script is called only if a field is edited manually.

You can call this script using the Execute field's script action.

201
Change Relational Field Value

Parameters: Field, Recordset, Operation

Used to add/delete records in the many-to-many relational field or simple relational field. You should specify a
necessary field in the Field parameter. The recordset to be added or deleted is specified as a variable of the
RecordSet type in the Recordset parameter. The Operation parameter specifies whether records should be removed
from the field or added to it. Before you use this action, you should create a variable containing the recordset you
want to add or delete from the field. To create the variable, you should use a script (to learn more, see the Variables
section).

An example of the script copying records from one relational field into another:

If a value of a field is changed with the help of this command, the "On Edit" script will not be called for the changed
field. This script is called only if a field is edited manually.

You can call this script using the Execute field's script action.

RETURN VALUE: Returns 1 if the field was changed; otherwise 0 is returned.

Change Image/File Field Value

Parameters: Field, PathToFile

Set a picture/file for the field specified in the Field parameter from a file specified in the File parameter. File is a
text formula parameter, so it can contain variables, field values, etc.

File can be a path to a local file or an URL to a file in the Internet.

Examples:

• Change Image/File Field Value ([Photo],"C:\my_photo.gif")


• Change Image/File Field Value ([Photo],"[$path_to_file]")
• Change Image/File Field Value ([File], "D:\Project X\[DocName].doc")
• Change Image/File Field Value ([File], "http://www.brilliantdatabase.com/des/logo.gif") - download an
image file from the web.

If a value of a field is changed with the help of this command, the "On Edit" script will not be called for the changed
field. This script is called only if a field is edited manually.

You can call this script using the Execute field's script action.

202
Clear Field

Parameters: Field

Deletes the content of the Field (clears it).

If a field is of Relational type, all records will be removed from it; if a field is of File/Image type, the corresponding
image or file stored in the database will be removed.

If a value of a field is changed with the help of this command, the "On Edit" script will not be called for the changed
field. This script is called only if a field is edited manually.

You can call this script using the Execute field's script action.

Extract Image/File

Parameters: Field, PathToFile

Extract a file from the field specified in the Field parameter and save this file to PathToFile location. PathToFile is
a text formula parameter, so it can contain variables, field values, etc.

Examples:

• Extract Image/File ([Photo],"C:\my_photo.gif")


• Extract Image/File ([Photo],"[$path_to_file]")
• Extract Image/File ([File], "D:\Project X\[DocName].doc")

Execute field's script

Parameters: Field, Script

For every field it is possible to define scripts that will be executed when a specific action is performed with the field.
For example, you can create a script that will be called when the field value is changed ("On Edit") or when the field
is double-clicked ("On double Click").

These scripts are called only if the action is performed by the user. That is, if the field value is changed from the
script (for example, with the help of the "Set Field Value" command), then the "On Edit" script will not be called.

This command is used to call the script "stored" in the field. The Field parameter determines the field for which the
script should be called; the ScriptType parameter determines what script should be called (by default, "On Edit").

This action can also be used to avoid scripts duplication. For example, we have the [Cost], [Discount] and
[Quantity] fields. And we want to re-calculate the total when the value in any of these fields is changed. Not to write
the script for re-calculation for every field, we will write it to "On Edit" of the [Cost] field, and for the [Discount]
and [Quantity] fields in the "On Edit" script will define the following action:

Execute field's script ([Cost],"On Edit"])

203
Open Input Dialog for Field

Parameters: Field

Used to move the input focus to the specified Field and open an input dialog if necessary, i.e:

• For a date field: Calendar will be shown;


• For a relational field: Corresponding "Select Record(s)" dialog will be shown;
• For an image field: "Open File" dialog will be shown.

To easily move the input focus to a specific field, use the Move to Field action.

Spell-Check Field

Parameters: Field

Used to spell-check words in the specified Field. If an error is detected, a corresponding dialog will be displayed:

Learn more about Spell check...

204
RECORDS OPERATIONS
Add Record

Parameters: RecordType, ParentFolder, Relation, CreationMethod

Used to create a new record of the specified RecordType in the specified ParentFolder.

If the RecordType parameter is not specified, the new record will be of the same type as the selected one. If no
record is selected, a record of the main type will be created (a top row in the Add menu).

If the ParentFolder parameter is not specified, the record will be created in the current folder or in the default folder
specified for this record type (in Form Editor).

If the Relation parameter has the Yes value, the added record will be linked to the selected record by many-to-many
relation; otherwise the relation will not be created.

CreationMethod parameter may possess the following three values:

• Create and select - a new empty record is created and selected for editing in the main software window;
• Just Create New Record - a new empty record is created, but not highlighted, i.e., the record marked as
current before creating the new record, remains the same.
• Create using popup form - a pop-up form for a record entry is displayed to the user. If the user clicks OK,
a record will be created with all entered data. If the user clicks Cancel, the record will not be created.

RETURN VALUE: Returns a recordset with the created record if record was created successfully; otherwise 0 is
returned.

For example, you can use this recordset to set fields of a new record created using the "Just Create New Record"
method:

1 [$rec_id] = Add Record (Payment, Payments, No, Just create new record)
2 For Each Record From [$rec_id]
3 Payment: [Payment type] = "Credit Card"
4 Next Item

205
Delete Records

Parameters: Method, RecordsToDelete

This action is used to delete records.

The Method parameter can take two values:

• Move to Recycle Bin - records selected in the current folder will be moved to the Recycle Bin. If selected
records are already in the Recycle Bin, the user will be offered to permanently delete them from the
database. That is, this method duplicates the "Records->Delete..." command. The RecordsToDelete
parameter is ignored.
• Completely delete records (irreversible) - permanently deletes records selected with the
RecordsToDelete parameter without notification and intermediate placing of records to the Recycle Bin.
After this action is performed, the deleted records cannot be restored. Such deletion cannot be
accomplished if the user works with the database remotely (by the network).

Note. To perform this command, all records to be deleted should be stored in the same folder.

RETURN VALUE: Returns 1 if records have been deleted; otherwise 0 is returned.

Clone Records

Parameters:

Used to create a replica of the selected records in the current folder.

At cloning, values of all fields are copied, except many-to-many relational fields.

RETURN VALUE: Returns 1 if records have been cloned successfully; otherwise 0 is returned.

Move Records

Parameters: Destination, RecordsToMove

Used to move records specified by the RecordsToMove parameter into the folder specified by the Destination
parameter.

Note. To perform this command, all records to be deleted should be stored in the same folder.

RETURN VALUE: Returns 1 if records have been moved successfully; otherwise 0 is returned.

Sort Records

Parameters: SortOrder

Used to sort records in the current folder using the specified SortOrder. If SortOrder is not specified, the dialog for
sorting records will be opened.

206
Popup Record

Parameters: RecordsToShow, RecordByDefault

Used to show the recordset specified in the RecordsToShow parameter in a new window:

The records opened in a new window can be edited. To choose the record for editing, use the arrow at the bottom of
the screen. For this operation to be successful, all records in the set should be of the same type.

Using a RecordByDefault parameter, you can set up a default record for the opened window.

Learn more about recordsets...

Change Access Rights

Parameters: Records, Access Level, User Groups

Changes access level for the specified user groups for the specified records. To change access level for several
groups at once, type their names separated by comma. Examples:

Change Access Rights(Current Record, Read Only, "Clients")


Change Access Rights(Selected Records, Read and Write, "Clients, Guests")

Note: only users with full access can change access levels.

Print Records

Parameters: ShowPrintPreview, Records, ReportStyle

Used to print out records specified by the Records parameter.

If the ShowPrintPreview parameter is specified, the preview window will be displayed before printing. Otherwise
the printing process will start without any notification.

The ReportStyle parameter determines what report style will be used.

Execute Query

Parameters: Query

Used to execute a query. If the Query parameter is not specified, a dialog with the list of all queries in the database
will be displayed.

RETURN VALUE: Returns the number of records found by the query.

207
FOLDERS OPERATIONS
Add Folder

Parameters: ParentFolder, FolderName, BaseOnFolder

Used to create a new folder. The folder in which the folder will be created is specified in the ParentFolder
parameter.

The FolderName parameter determines the name of a folder. If this parameter is skipped (empty), the user will see a
dialog window proposing to choose the folder name.

In the BaseOnFolder parameter you can specify the name of a folder from which all folder properties will be
copied: icon, colour, style of displaying and so on.

RETURN VALUE: Returns 1 if folder has been created; otherwise 0 is returned.

Move Folder

Parameters: MoveToFolder

Used to move the selected folder into the folder specified in the MoveToFolder parameter.

RETURN VALUE: Returns 1 if folder has been moved; otherwise 0 is returned.

Rename Folder

Parameters: NewName

Used to rename the selected folder. Use NewName to specify a new name for the folder. If NewName is skipped,
the input dialog will be opened.

RETURN VALUE: Returns 1 if folder has been renamed successfully; otherwise 0 is returned.

Change Folder Layout

Parameters: Layout, Table Style

Changes the current folder layout and allows to select a table style for the list of records in the folder (optional).

This action equals to menu commands "Folder->Layout->..." and "Folder->Table Style".

Delete Folder

Parameters:

Used to delete the current folder.

RETURN VALUE: Returns 1 if folder has been deleted successfully; otherwise 0 is returned.

208
NAVIGATION
Select Folder

Parameters: FolderToSelect

Used to go to the folder specified in the FolderToSelect parameter.

Select Record

Parameters: Record

Used to go to the specified Record.

Move to Record

Parameters: TypeOfMovement

Allows navigating by records in the current folder or another list.

Possible values of the TypeOfMovement parameter:

• << Move to first record


• < Move to previous record
• > Move to next record
• >> Move to last record
• History: Move to previous record
• History: Move to next record (Used to go back after using the "History: Move to previous record"
movement.

Switch to Sheet

Parameters: SheetToSelect

Allows selecting the specified tab of the current record.

Possible values of the SheetToSelect parameter:

• < Select previous sheet


• > Select next sheet
• Select sheet #N - select a specific tab number N.

Move to field

Parameters: FieldToSelect

Moves the input focus to the specified field FieldToSelect.

209
IMPORT/EXPORT/SEND OPERATIONS
Export/Send

Parameters: Template, Records

Used to export or send data according to the Export/Send Template specified in the Template parameter.

Depending on the type of selected template, this action can result in:

• exporting data to a text file (txt, csv, xml, etc);


• generating a web page;
• creating and sending e-mails directly from your database or using an external e-mail client (Outlook
Express, The Bat, etc). Learn more...
• copying data from your database into the Windows clipboard to insert it into any application later on;
• inserting data from your database into an open Microsoft Word document or generating MS Word
documents automatically based on the database data.

If the Template parameter is not specified, a dialog with the list of all templates in the database will be displayed.
The Records parameter indicates which records you want to export or send.

Export To a Database

Parameters: DatabasePath, ExportPreset, ShowPreview

Used to export data to the database with a different format (such as mdb or xls). DatabasePath is the path to the
database to which records are to be exported. ExportPreset is the import template, ShowPreview defines whether
the export dialog will be displayed. If ShowPreview is not set, the exporting process will start without any
notification. If ShowPreview is set, the dialog for setting up exporting parameters will be displayed. The dialog for
setting up exporting parameters will also be displayed if the DatabasePath or ExportPreset parameters are not
specified.

RETURN VALUE: Returns the number of exported records.

Import From a Database

Parameters: DatabasePath, ImportPreset, ShowPreview

Used to import data from the database with a different format (such as mdb or xls). DatabasePath is the path to the
database from which records are to be imported. ImportPreset is the import template, ShowPreview defines whether
the import dialog should be displayed. If the ShowPreview is not set, the importing process will start without any
notification. If the ShowPreview is set, the dialog for setting up importing parameters will be displayed. The dialog
for setting up importing parameters will also be displayed if the DatabasePath or ImportPreset parameters are not
specified.

RETURN VALUE: Returns the number of records were imported.

210
Connect to External DB

Parameters: PathToDB, TableName

Connects to an external database for data exchange.

The PathToDB parameter should contain a path to the database (for example, "C:\Doc1.xls" or
"C:\MyDBs\db1.mdb") or a connection string. For example to connect to MySQL database installed on the local
computer with MySQL ODBC driver you should use the follwoing connection string:

odbc;DRIVER={MySQL ODBC 3.51


Driver};SERVER=127.0.0.1;DATABASE=database_name_here;UID=user_name_here;PWD=p
assword_here;OPTION=3;

In case this parameter is empty the Microsoft Windows Database Connection Wizard will be displayed.

In the TableName you can define the name of the table (spreadsheet) with which you want to work. If this
parameter is skipped, the first table will be selected by default.

To work with the database after connecting, use the External DB Operation or External DB SQL Query actions.

RETURN VALUE: Returns 1 if connection complete successfully

External DB Operation

Parameters: Operation, ColRowIndex, RecordType, ValueToSet

Performs the specified Operation with the database of the Access or Excel format. Before the operation is
performed, it is necessary to connect to the database using the "Connect to External DB" command.

Possible operations:

• Operations of passing to specific records in the database. With the help of these operations, you can select
the current record (line) for which the Get/Set value operations can be performed afterwards.
o Move to first record - pass to the first record (line).
o Move to next record - pass to the next record (line).
o Move # rows - step over N records; N is specified in the ColRowIndex parameter.
• Add Record - add a new record at the end of the table and make it current.
• Set Value - set the value of column (field) number ColRowIndex equal to the parameter ValueToSet.
Note: ValueToSet is a text formula. To use values of fields from the current record in "Brilliant Database"
in it, it is necessary to define the type of record in the RecordType parameter.
• Get Value - reads the value of column (field) number ColRowIndex to the specified variable.

RETURN VALUE: Returns the cell value in case of the Get Value operation.

211
External DB SQL Query

Parameters: SQL Query, Records Separator, Fields Separator

This action sends a unique query (multiple queries are not supported) to the opened external database. Before using
this action an external database (e.g. MySQL, Access, MS SQL, etc) must be opened using the "Connect to External
DB" action.

"SQL Query" is a text formula so you can use any field or variable values to pass to external database

Examples:
SELECT * FROM users WHERE 1
SELECT * FROM users WHERE id=[user_id] ([user_id] will be replaced with the
value of the "User_ID" field of the current record in Brilliant Database)
UPDATE users SET name="Tom" Where ID=[user_id]
DELETE FROM users WHERE name="[$name_to_del]"

In case of "SELECT" query this action will return one big string with all the query result rows in one big text. To
specify custom separators for rows and columns use the "Records separator" and "Fields separator" parameters. E.g.
with default separators the result of "SELECT" query can look like:
id, name, age
1, Tom, 34
2, Bill, 39
3, Mary, 25

It is better to use the special "For each record from SQL query (External DB)" cycle to work with the "SELECT"
query results.

Close External DB

Closes connection to an external database.

212
NETWORK OPERATIONS
Share Database

Parameters: Port

Make the current database available for using in a network (share). Use the Port parameter to specify alternative
port for database sharing. By default port 6420 is used.

See the Networking section for more details.

RETURN VALUE: Returns 1 if the database was shared, otherwise 0 is returned.

Deshare Database

Parameters:

Make the DB inaccessible to the network connection. All connected users will be dropped.

See the Networking section for more details.

RETURN VALUE: Returns 1 if the database was deshared, otherwise 0 is returned.

Send Network Message

Parameters:

Sends a text message Message to specified users of a database.

Parameters.

• Message text;
• Type - type of the message:
o Simple - a usual message not requiring any actions from a client.
o Block Client Work - after this message is received, the work of a user will be blocked until he or
she receives a message of the Unblock Client Work type. It is recommended to send such
messages before server are going to execute a complex query or any other operation requiring a lot
of time.
o Unblock Client Work - unblocks users' work.
• Users - name of users separated by comma to send the message to. E.g. "Tom, Bill, Mary". In case this
parameter is empty, the message will be sent to all users.

By default, the incoming message will be displayed in the notification area. However, you can create your own
message handler and execute a custom script on message income. You can edit this script in the Script Designer
("Design DB

213
RECORD ATTACHMENTS OPERATIONS
Attach files to record

Parameters: SourceFolder/File, FilesMask, SpecialCommands

Used to attach a file or files from the SourceFolder directory that comply with the FilesMask template to the
current record. If you specify replace_by_date as one of the SpecialCommands, and the record already has
attachments that have similar names with the attachment you are adding, the attachment will be replaced in case the
file you want to add was modified later than the current file.

Examples:

• Attach files to record ("C:\Doc1.doc","")


• Attach files to record ("C:\MyImages\Hello.gif","")
• Attach files to record ("C:\FilesToAttach","*.*")
• Attach files to record ("C:\MyDocs","*.doc")
• Attach files to record ("C:\MyDocs","*.doc","replace_by_date")
• Attach files to record ("C:\MyDocs","*.zip")

RETURN VALUE: Returns the number of attached files.

Remove attachments

Parameters: FilesMask

Used to delete attachments with names that comply with the FilesMask from the current record.

Examples:

• Remove attachments ("*") - delete all attachments;


• Remove attachments ("*.doc") - delete all Ms Word attachments;
• Remove attachments ("*.zip") - delete all Zip archive attachments;

RETURN VALUE: Returns the number of removed files.

214
Create attachment

Parameters: AttachmentName, AttachmentTextData

Create an attachment with the AttachmentName name and content specified by a AttachmentTextData text
formula.

Examples:

• Create attachment ("hello.txt","Hello World!!!")


• Create attachment ("comments.txt","[$_date] [$comment]")

Save attachments

Parameters: FolderName, FilesMask

Save attachments of a current record in to a folder specified by the FolderName parameter. Use the FilesMask
parameter to filter attachments you want to save.

Examples:

• Save attachments ("C:\ExtractedFiles","*")


• Save attachments ("C:\MyDocs","*.doc")
• Save attachments ("C:\ArchivesFromDB","*.zip")

RETURN VALUE: Returns the number of saved files.

215
EXTERNAL FILES OPERATIONS
Open File/URL

Parameters: FileOrURL, Parameters

Used to open the file or the Web page specified in the FileOrURL parameter.

If the program is selected as a file, parameters defined in Parameters will be passed to it.

Examples:

• Open File/URL ("htt://www.google.com")


• Open File/URL ("http://www.google.com/search?q=[$text]")
• Open File/URL ("[$url]")
• Open File/URL ("C:\Doc1.doc")
• Open File/URL ("C:\MyMusic\Song1.mp3")
• Open File/URL ("cmd")
• Open File/URL ("C:\Compiler.exe","projectx")
• Open File/URL ("C:\Program Files\WinRAR\WinRAR.exe","a backup1 *.*")

Play Music/Video File

Parameters: Path, Command, Additional

This command allows reproducing any media file (music, video) located by the specified Path in case
corresponding drivers and codecs are installed in the system. This command is most commonly used to reproduce
files of the next formats: mp3, wav, avi, mpg, mid.

Possible values of the Command parameter:

• Play - start a file playback. If the selected file is a video file, it will be reproduced in a new window. At that
you can additionally specify the range of playback in the Additional parameter. For example:
Play Music/Video File ("C:\yesturday.mp3", "Play")
Play Music/Video File ("C:\01.avi", "Play")
Play Music/Video File ("C:\01.avi", "Play", "FROM 100 TO 200")
Play Music/Video File ("C:\01.avi", "Play", "FROM 0 TO 100")
• Stop - stops the playback. For example:
Play Music/Video File ("C:\yesturday.mp3", "Stop")
Play Music/Video File ("C:\01.avi", "Stop")
• mciExecute - sends commands specified in the Additional parameter directly to the standard mcuExecute
MS Windows interface. The Path parameter is ignored in this case. For example, the following succession
od commands will execute playback of a video file in a non-standard window with slow speed:
Play Music/Video File ("","mciExecute","OPEN "d:\02.avi" TYPE AVIVIDEO ALIAS myvideo STYLE
POPUP")
Play Music/Video File ("","mciExecute","PUT myvideo WINDOW AT 100 100 600 400")
Play Music/Video File ("","mciExecute","SET myvideo SPEED 500")
Play Music/Video File ("","mciExecute","PLAY myvideo WAIT")
Play Music/Video File ("","mciExecute","CLOSE myvideo")

To learn more about the mciExecute interface, click here.

216
Write to file

Parameters: FilePath, Data,

Used to write the text specified in the Data parameter to the file specified in the FilePath parameter. If the specified
file does not exist, it will be created. If the specified file already exists, its content will be replaced. For example:

Write File ("C:\test_write.txt", "Hello World. Time is [$_time]")

RETURN VALUE: Returns 1 if the data has been written to the file successfully.

Read File

Parameters: FilePath

Used to read the content of the file specified in the FilePath parameter.

RETURN VALUE: Returns the content of the file.

Read File Attribute

Parameters: FilePath, ReturnValue

Returns the attributes of the file specified in the FilePath parameter. The ReturnValue parameter defines the
attribute to be returned:

• Size - file size, bytes;


• Modified date - date when the file was last modified;
• Modified time - time when the file was last modified;
• If file exists - returns 1 if the specified file already exists;

RETURN VALUE: Returns the specified file attribute.

Rename File

Parameters: SourceFilePath, DestanationFilePath

Used to change the name of a file specified in the SourceFilePath parameter to the name specified in the
DestanationFilePath parameter. For example:

Rename File ("c:\mydoc.doc","c:\yourdoc.doc") - renames the file from mydoc.doc into yourdoc.doc.

Rename File ("c:\mydoc.doc","d:\mydoc.doc") - moves the file from disk C on disk D.

RETURN VALUE: Returns 1 if the file has been renamed successfully.

217
Copy Files

Parameters: From, To, Mask, IncludeSub

Used to copy the content of the From directory to the To directory. Mask defines the mask with which the files to
be copied must comply. If IncludeSub contains yes, the command will also copy all files and folders contained in
the source directory. For example:

Copy Files ("c:\test1", "c:\test2", "*.doc", "No") - copies all DOC files from the test1 folder to the test2 folder. At
the same time, the nested files will not be copied.

Copy Files ("c:\test1", "c:\test2", "*", "yes") - copies the whole content of the test1 folder to the test2 folder.

RETURN VALUE: Returns 1 if files have been copied successfully.

List Files

Parameters: Directory, Mask, IncludeSub

Returns the list of files contained in the folder specified in the Directory parameter that comply with the specified
Mask. Files in the list are separated with the carriage return character; i.e., each line in the returned list will contain
only one file. If the IncludeSub parameter contains yes, the list will also include all nested files. To perform
operations over each file in the list, you can use the For each line from text loop. Example of obtaining a list:

List Files ("C:\Test", "*.doc", "yes"). If files in the folder specified in the path exist, the command will return a list
like this:

c:\Test\MyDoc1.doc
c:\Test\MyDoc2.doc
c:\Test\Folder2\MyDoc3.doc

RETURN VALUE: Returns a list of files.

Delete Files

Parameters: Directory, Mask, IncludeSub

Used to delete files in the folder specified in the Directory parameter that comply with the specified Mask. If the
IncludeSub parameter contains yes - the command will also delete all nested files and folders. Example:

Delete Files ("C:\Test", "*.tmp", "yes") - deletes all ZIP archive files in the "C:\Test" folder and in the nested
folders.

RETURN VALUE: Returns 1 if files has been deleted successfully.

Create Directory

Parameters: DirectoryPath

Used to create the directory (folder) specified in the DirectoryPath parameter. For example:

Create Directory ("c:\test_dir")

RETURN VALUE: Returns 1 if the directory has been created successfully.

218
Delete Directory

Parameters: DirectoryPath

Used to delete the directory (folder) specified in the DirectoryPath parameter. For example:

Delete Directory ("c:\test_dir")

If the folder specified in the parameter is not empty, it will not be deleted.

RETURN VALUE: Returns 1 if the directory has been deleted successfully.

219
SOFTWARE OPERATIONS
Switch Topmost

Parameters: Action

Used to switch the mode for viewing program windows on top of all other windows. When this mode is on, the
program window will never be hidden behind the windows of other applications.

Action parameter:

• Switch - switch TopMost mode;


• Make topmost - turn On topmost mode.
• Make normal - turn Off topmost mode.

Show Designer

Parameters:

Opens one of designers available in Brilliant Database.

Possible values of the Designer parameter:

• Form Editor
• Query Editor
• ToolBar Editor
• Export/Send Templates Editor
• Report Style Editor

Show Help File

Parameters:

Show the Brilliant Database Help file.

Open a Database

Parameters: DatabasePath

Used to open the database specified in the DatabasePath parameter. If the DatabasePath is not specified, the user
will be suggested to specify the path to the database.

Exit Program

Parameters:

Close Brilliant Database.

220
MISCELLANEOUS
Show Message

Parameters: MessageText, DialogTitle, Buttons

Show a message with the specified MessageText and the DialogTitle heading:

The Buttons parameter determines what buttons and appearance the Message Box should have. Possible variants:

• Ok
• Ok, Cancel
• Yes, No, Cancel
• Abort, Retry, Ignore
• Exclamation
• Critical
• Critical + Ok, Cancel
• Critical + Yes, No, Cancel
• Critical + Abort, Retry, Ignore

RETURN VALUE: Name of the pressed button, that is, one of values: ok, cancel, yes, no, abort, retry, ignore.

Show 'Find' Dialog

Parameters: DefaultFolder, DefaultText

Used to open the Find/Replace Records window. By default, the specified DefaultText will be searched in the
specified DefaultFolder.

Show Report Style

Parameters: Records, ReportStyle, WhatPart

Show a window with a report. The ReportStyle parameter determines what report style will be used. The Records
parameter determines the group of records to be used for the report. The WhatPart parameter determines what part
of report style will be used to show the report.

221
Get web-page content

Parameters: URL, ImportType, Connection

Import text from a web page specified at URL and svae it to a variable. The ImportType parameter specifies the
way the data should be imported - including html tags or not. The Connection parameter defines the connection type
to be used when importing data:

• Direct - dedicated fast-speed connection; unfortunately, some websites can prohibit this connection type.
• Web-Browser - the program simulates a web browser and returns the page content as if it was viewed
through a regular browser.

Example:

Get web-page content("http://www.google.ru/search?q=database","Text only","Web-Browser") - returns google


search results for the term "database".

RETURN VALUE: Content of a web page located by the URL address.

Create a Backup

Parameters: Path, FileMask, Rewrite

Used to create a backup copy of the current database at the Path under the FileMask name. The FileMask
paremeter can contain the current date or (and) time. If Rewrite equals to Always, the specified file will be rewritten
without any notification.

RegExp Match

Parameters: Test String, Regular Expression (Pattern)

Search Test String for a match to the regular expression given in Pattern.

Returns the first math.

Example:

1 [$res] = RegExp Match ([E-Mail], [a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z]


[a-zA-Z\.]*[a-zA-Z])
2 Show Message ([$res], , Ok)

This will show an e-mail address if a valid e-mail address was entered in the [E-Mail] field.

See Also: For each match by regular expression cycle.

222
Win SendMessage

Parameters: Target hWnd, Message, wParam, lParam

Sends the specified message (WM_USER or WM_COPYDAT) to a window specified by the hWnd handle.

Parameters:

• Target hWnd - identifier of the window (HWDN) to which a message should be sent;
• Message - sent message. There are only two variants possible - WM_USER and WM_COPYDATA;
• wParam - value written to wParam when the WM_USER message is passed (number).
• lParam/lpData
o For the WM_USER message - value written to lParam;
o For the WM_COPYDATA message - string written to lpData of the COPYDATASTRUCT
structure.

For more information about using this action review the Send Message, WinAPI topic in the "Creating Addons and
Advanced Integration" section.

Show Notification

Parameters: Notification Text, Button Text, Pass to the notification script (Pars)

Add a notication to the notification area (right-bottom part of the main window):

Notifications can be used to inform a user about upcoming meeting, warnings and other events which dont require
immediate action. In contrast to message boxes, notifications dont block the software.

Parameters:

• Notification Text - a text that will be shown on notification. The notification area only shows about 300
symbols;
• Button text. If this parameter is not empty a button will be added on the notification with this text (on the
picture above it is "Show Information."). A click on this button will execute special "On notification button
click" script (see below).
• Pars - this data will be passed to the "On notification button click" script. For example, you can pass a
record id to show this record on button click.

On Notification Button Click Script

To edit a script that will be executed when a user clicks the button, open Script Designer ("Design DB

223
FTP: Upload Files

Parameters: RemoteHost/Dir, Login:Password, FileSet

Used to upload a specified fileset to the FTP server. Files are specified in the FileSet parameter and can be both
record attachments and/or ordinary files.

• In the RemoteHost/Dir parameter you should specify the FTP server and the folder where the files should
be uploaded, for example, ftp://ftp.mywebsite.com/myfolder.
• In the Login:Password parameter you should specify the login and password to your FTP server, for
example, john:zRtnGfd.

RETURN VALUE: Returns the number of uploaded files.

FTP: Delete Files

Parameters: RemoteHost/Dir, Login:Password, FileMask

Used to delete files from the FTP server if their names comply with the FileMask template.

• In the RemoteHost/Dir parameter you should specify the FTP server and folder from which the files should
be deleted, for example, ftp://ftp.mywebsite.com/myfolder.
• In the Login:Password parameter you should specify the login and password to your FTP server, for
example, john:zRtnGfd.

Execute User Function

Parameters: UserFunction, Parameter 1, Parameter 2...

Used to perform the specified UserFunction that has a set of parameters specified in Parameters. To learn more,
see the User Functions section.

RETURN VALUE: Returns the result of User Function if such option is set for the selected User Function.

224

Das könnte Ihnen auch gefallen