Variables are used to store data and can be classified into two primary categoriesregular variables and object reference variables. A regular variable is used to store a literal string as the program executes. This type of variable can be subdivided into scalar and variant variables.
A scalar variable is used to store data based on a specific data type. In other words, the variable type and data value must be compatible. A variable that's defined as an integer could store a number but could not store a text string. The following describes the various scalar data types.
Scalar Type |
Keyword |
Symbol |
Description |
---|---|---|---|
Integer |
INTEGER |
% |
Used to store whole numbers between 32,768 and +32,767. |
Long |
LONG |
& |
Used to store large numbers between 2,147,483,648 and +2,147,483,647. |
Single |
SINGLE |
! |
Used to store floating-point numbers that range between + or 7 floating point digits. |
Double |
DOUBLE |
# |
Used to store double-precision floating-point numbers that range between + or 17 floating point digits. |
Currency |
CURRENCY |
@ |
Used to store currency values. |
String |
STRING |
$ |
Used to store alphanumeric text string values. |
The symbols are suffix characters that can be used as variable identifiers as well as to implicitly declare the variable. An implicitly defined variable does not require a DIM statement. However, best practices suggest that you should always declare all variables.
Variant variables, on the other hand, are considered to be general purpose and can accept data regardless of the data value. These variables can store any type of value including numbers, strings, arrays, and built-in constant values such as NULL and EMPTY. Although this variable type provides the flexibility to store varying types of data, it's important to understand that it requires more memory and is processed more slowly than scalar variables. Where possible, the use of variant variables should be minimized.
Object reference variables, as the name implies, are used to associate an object with a LotusScript variable. After a variable has been associated with an object, you can obtain its properties or manipulate its content. Figure 6.2 illustrates the relationship between each of the variables.
Figure 6.2. Types of variables
An Introduction to the Lotus Domino Tool Suite
Getting Started with Designer
Navigating the Domino Designer Workspace
Domino Design Elements
An Introduction to Formula Language
An Introduction to LotusScript
Fundamentals of a Notes Application
Calendar Applications
Collaborative Applications
Reference Library Applications
Workflow Applications
Web Applications
Design Enhancements Using LotusScript
Design Enhancements Using Formula Language
View Enhancements
Sample Agents
Miscellaneous Enhancements and Tips for Domino Databases
Data Management
Security
Application Deployment and Maintenance
Troubleshooting
Appendix A. Online Project Files and Sample Applications
Appendix B. IBM® Lotus® Notes® and Domino®Whats Next?