About FirstClass RAD
Creating FirstClass RAD applications
Using FirstClass RAD with databases
Programming projects
Testing applications
Building applications
Installing applications in FirstClass
Language reference
About FirstClass RAD
FirstClass Rapid Application Developer (FirstClass RAD) lets you enhance FirstClass client functionality with intranet applications, including interfaces to databases.
Although FirstClass RAD must be installed on a Windows machine, you can use any FirstClass client (Windows or Mac OS) to run it, and your users can also use any FirstClass client to run your FirstClass RAD applications. 
To create FirstClass RAD applications, you create the required forms using FirstClass Designer, then (using the BASIC language) program the event procedures for the objects on the forms in FirstClass RAD. 
FirstClass RAD naming conventions
When you name FirstClass objects such as forms and fields, and code elements such as variables, constants, and subroutines, these names must:
•	begin with a letter
•	contain only letters, numbers, and the underscore character (_)
•	be no longer than 255 characters
•	differ from the names of BASIC operators and logical operators such as OR, AND, MOD, and NOT.
Examples
•	Form
•	frm
•	FileOpen
•	frmFileOpen
•	Checkbox
•	chk
•	ReadOnly
•	chkReadOnly
Top
Creating FirstClass RAD applications
With minor variations, you follow the same basic steps to create all FirstClass RAD applications. For conceptual information and detailed steps on creating RAD applications, see FirstClass Rapid Application Developer Guide. 
About FirstClass RAD projects
A FirstClass RAD application is created as a project which consists of:
•	forms
•	code modules
•	database objects (if the application is connecting to a database).
To work with a FirstClass RAD project, you use the FirstClass RAD Project Manager, which provides access to:
•	information about the project as a whole
•	information about the forms in the project
•	database connection information, for applications that connect to databases
•	information about the database tables to use, for applications that connect to databases.
The FirstClass RAD Project Manager also lets you run your application for testing purposes, without having to rebuild and reinstall every time you want to test.
Creating projects
To create a FirstClass RAD project:
1	Connect, as an administrator, to the server where FirstClass RAD is installed.
	Use the settings file that contains the resources needed for this project.
2	Start FirstClass RAD.
3	Click New on the FirstClass RAD Project Manager's Project tab.
4	Type the project name (maximum 23 characters, no spaces).
5	Click OK.
Opening projects
To open a project:
1	Click Open on the FirstClass RAD Project Manager's Project tab.
2	Select the project.
3	Click OK.
Setting project attributes
Project attributes apply to the project as a whole. To set these attributes:
1	Click Options on the FirstClass RAD Project Manager's Project tab.
2	Fill in the fields for each tab on the Project Attributes form.
3	Click OK.
Adding forms to projects
To add a form to a project:
1	Click New on the FirstClass RAD Project Manager's Form tab.
2	Choose the form.
3	Click OK.
	The form and its Attributes form open.
Setting form attributes
Form attributes (the form's name, title, and tables for bound columns databases) apply to the form as a whole, rather than to individual fields on the form.
To set form attributes:
1	Select the form on the FirstClass RAD Project Manager's Form tab.
2	Click Modify.
3	Fill in the fields on the Attributes form's Form tab.
4	Bind the form to database tables, if required. 
Click Add, choose a table at "Select a table", then click OK.
5	Press Tab to save your changes before closing the Attributes form.
Setting field attributes
Field attributes apply to the individual fields on a form.
To set the attributes (name and table/column for bound columns databases) for a field:
1	Select the form on the FirstClass RAD Project Manager's Form tab.
2	Click Modify.
3	Click the field.
4	Fill in the fields on the Attributes form's Field tab.
5	Bind the field to a database table, if required.
Choose the appropriate table at "Table", then choose the appropriate column from this table at "Column".
Removing forms from projects
When you remove a form from a FirstClass RAD project, all of the configuration and code that was assigned to the form is also removed. You cannot undo this operation.
To remove a form from a project:
1	Select the form on the FirstClass RAD Project Manager's Form tab.
2	Click Remove.
Top
Using FirstClass RAD with databases
FirstClass RAD applications can connect to any ODBC-compliant database (ODBC is the industry standard for relational database access). A FirstClass RAD form can tie into multiple database tables and multiple databases. The databases can be on different servers. For fields that will always contain data from the same source (the same column in a database table), you can create bound columns database access.
For more flexibility, when you do not have fields that are bound to a particular column, you can create nonbound database access.
Creating ODBC data sources
Before a FirstClass RAD application can connect to an ODBC-compliant database, you must use Windows to create an ODBC data source. 
To do this:
1	Open ODBC in the Windows Control Panel.
2	Click Add on the ODBC Data Source Administrator's System DSN tab.
3	Select the ODBC driver for your database.
4	Click Finish.
5	Fill in the fields to set up the driver. 
For help, use Windows' online help or see the driver manufacturer's documentation. 
6	Click OK.
Note
You need only connect to your ODBC database source once for all applications.
If you want to test the data source, you can connect to it with an ODBC client such as Microsoft Query, Microsoft Access, or Microsoft Excel.
Adding database connections
To add a database connection:
1	Click New on the FirstClass RAD Project Manager's Connection tab.
2	Fill in the connection information on the New Connection form.
3	Click OK.
Updating database connections
To update a database connection:
1	Select the connection on the FirstClass RAD Project Manager's Connection tab.
2	Click Modify.
3	Change information as required on the Connection form.
4	Click OK.
Removing database connections
When you remove a database connection from a FirstClass RAD project, all tables associated with it are also removed. You cannot undo this operation.
To remove a database connection:
1	Select the connection on the FirstClass RAD Project Manager's Connection tab.
2	Click Remove.
Adding database table connections
Before you can add a connection to a table in a database, you must add a connection to the database as a whole.
To add a connection to a table in a database:
1	Click New on the FirstClass RAD Project Manager's Table tab.
2	Fill in the table information on the New Table form.
3	Click OK.
Updating database table connections
To update database table connections:
1	Select the table on the FirstClass RAD Project Manager's Table tab.
2	Click Modify.
3	Change information as required on the Table form.
4	Click OK.
Removing database table connections
When you remove a database table connection from a FirstClass RAD project, all associations to that table in the project's forms are also removed. You cannot undo this operation. 
To remove a connection to a table in a database:
1	Select the table on the FirstClass RAD Project Manager's Table tab. 
2	Click Remove.
Top
Programming projects
Programming FirstClass RAD projects includes adding code, subroutines, and database connections (if applicable).
Data types in code
Each variable in your code has a data type that determines what kind of data that variable can store. For example, String variables store text strings, and Integer variables store whole numbers.
Before you can use a variable in your code, you must declare it and its data type. This ensures that a variable only contains a value of the expected data type (for efficiency, FirstClass RAD does not support variables that can contain ambiguous data types).
Data types and databases
Both FirstClass RAD and databases require that all data contained in their data structures have explicit data types. 
If your FirstClass RAD application will be connecting to a database, you must be sure to use data types that are compatible with the corresponding database data types. These are the FirstClass RAD counterparts for common ODBC database data types:
•	Integer
	integer, int, smallint, tinyint, boolean, bit, yes/no
•	Long
	integer, int, smallint, tinyint, boolean, bit, yes/no
•	Single
	float, double, single, double precision, decimal, numeric
•	Double
	float, double, single, double precision, decimal, numeric
•	Currency
	monetary, money, currency, smallmoney
•	String
	char, character, varchar, variable character, text, memo
•	Date.
	date, time, date/time, datetime, smalldatetime
Adding code
Programming a FirstClass RAD project involves:
•	adding code that is used throughout the project
•  adding code for forms
•  adding code for fields.
Adding code for projects
A FirstClass RAD project often contains code that is global (that is, it is called from multiple forms, multiple fields on a form, or anywhere in the project). This code can take the form of:
•	subroutines
	Code that performs particular steps. Instead of repeating the code for a step wherever it is needed, you can call the subroutine.
•	declarations
	A variable, constant, or user-defined type used when programming applications.
•	variables
	A placeholder in your code for particular values, such as values that users have entered. You must declare a variable before you can use it.
•	constants
	Similar to variables, except the value of a constant cannot be changed.
•	user-defined data types.
	Combinations of related variables into single data structures.
Store global code in a code module. This lets you write the code once, instead of multiple times, and any changes to this code are automatically reflected everywhere the code is called.
By default, a project has one code module, called Module1. This module contains a Declarations section and a Main subroutine which is the entry point for your application. The application begins execution with the first line of code you add to the Main subroutine. You can add more code modules as needed for organizational purposes.
Adding code for forms
To add code that applies to a specific form:
1	Select the form on the FirstClass RAD Project Manager's Form tab.
2	Click Modify to open the form and its Attributes form.
3	Click the form body, then click Edit Code on the Attributes form's Form tab.
	Shortcut
	Double-click the form body.
4	Choose the event procedure that you want to program at "Event".
5	Update the code as required.
6	Press Tab to save your changes before closing the code window.
Adding code for fields
To add code that applies to a specific field on a form:
1	Select the form on the FirstClass RAD Project Manager's Form tab.
2	Click Modify to open the form and its Attributes form.
3	Click the field, then click Edit Code on the Attributes form's Field tab.
	Shortcut
	Double-click the field.
4	Choose the event procedure that you want to program at "Event".
5	Update the code as required.
6	Press Tab to save your changes before closing the code window.
Note
You can choose additional event procedures to program for this field, and choose additional fields to program at "Object".
Adding code modules
To add a code module:
1	Click New on the FirstClass RAD Project Manager's Module tab.
2	Type the module name (maximum 23 characters, no spaces).
3	Click OK.
	The module window opens.
Updating code modules
To add, edit, or delete code in a code module:
1	Select the module on the FirstClass RAD Project Manager's Module tab.
2	Click Modify.
3	Update the code as required.
4	Press Tab to save your changes before closing the code window.
Renaming code modules
To rename a code module:
1	Select the module on the FirstClass RAD Project Manager's Module tab.
2	Click Rename.
3	Type the new module name.
4	Click OK.
Removing code modules
When you remove a code module from a FirstClass RAD project, all of the subroutines and declarations within it are also removed. You cannot undo this operation.
To remove a code module from a project:
1	Select the module on the FirstClass RAD Project Manager's Module tab.
2	Click Remove.
Updating declarations
To add, update, or remove declarations in a code module:
1	Open the window for this code module.
2	Choose Declarations at "Subroutine".
3	Update the code as required.
4	Press Tab to save your changes before closing the code window.
Adding subroutines
To add a subroutine to a code module:
1	Open the window for this code module.
2	Click New Subroutine (blank icon in upper right-hand corner).
3	Name your subroutine, then click OK.
Updating subroutines
To add, edit, or delete code in a subroutine:
1	Open the window for the appropriate code module.
2	Choose the subroutine at "Subroutine".
3	Update the code as required.
4	Press Tab to save your changes before closing the code window.
Removing subroutines
When you remove a subroutine from a code module, all of the code within it is also removed. You cannot undo this operation. 
To remove a subroutine from a code module:
1	Open the window for this code module.
2	Choose the subroutine at "Subroutine".
3	Click Delete Subroutine (icon with an "X" on it, in the right-hand corner).
Top
Testing applications
You can run your application within FirstClass RAD before it is built, to check for errors. This avoids the need to continually rebuild and reinstall applications in order to test them. You can run the application at various stages of development (for example, after you have added all your forms), and it will respond based on the amount of code you have written for it at that time.
To test your project:
1	Click Run on the FirstClass RAD Project Manager's Project tab.
	If an error message appears, click OK and check the code in your code module.
2	Click Stop to stop testing your application.
Top
Building applications
After your project has been fully developed and tested, you can build the application from it. To do this:
1	Click Build on the FirstClass RAD Project Manager's Project tab.
	The compiled application file (FCX) is added to the \FCPO\RAD folder. This file contains everything needed to run the application after it has been installed in FirstClass.
	Note
	If you built this application previously, the new FCX file will overwrite the old one.
2	Restart the server to load the FCX file.
Top
Installing applications in FirstClass
After you have built your FirstClass RAD application, you need to install it in FirstClass so others can use it. To install your application:
1	Create stationery for the application.
This is only required for applications that will be launched from an icon.
2	Distribute the resources (forms, icons, and so on) used by your application.
	For details on how to distribute resources, see FirstClass Designer.
Creating application stationery
To create stationery so that users can launch your application from an icon:
1	Log in as an administrator, using your FirstClass RAD project's settings file.
2	Open the conference where you want the application icon.
3	Choose Admin > New Stationery > RAD Install Form.
4	Fill in the RAD Install Form fields, then click OK.
5	Choose File > Properties (Windows) or Get Info (Mac OS) with the stationery selected.
6	Clear "Protected".
7	Name the stationery and choose the icon you want.
8	Click OK.
9	Open the Properties window again, and select "Protected".
10	Click OK.
Note
You can install multiple instances of this application by opening other conferences and following the steps above.
Top
Language reference
The Language reference describes the commands, methods, attributes, and so on, that you can include in your BASIC code for FirstClass RAD applications. For examples of these objects in use, see the Example file on your FirstClass RAD CD.
BASIC commands
BASIC operators
BASIC variables
Column attributes
Connection attributes
Connection methods
Email attributes
Email methods
Form attributes
Form events
Form methods
Field attributes
Field events
Field methods
Field types
File attributes
File methods
Internal functions
FirstClass internal functions
Statement attributes
Statement methods
BASIC commands
Beep
Plays the FirstClass client's system beep sound.
Note
The FirstClass client cannot play the system beep unless the application has displayed a form.
Syntax
Beep
Example
Sub Click()		
	Dim i as integer 
	For i = 1 to 3 		'Beep 3 times	
	Beep	Next i
End Sub
Call
Calls a subroutine.
This is an optional command; you can call subroutines directly without using it.
Syntax
Call subroutine
Call subroutine(arg1, arg2...)
subroutine
You can add arguments (arg1, and so on) to this command.
Example
Sub Main()	
	Call MyStartupSub(StartupString)
	Call MyMainProgramSub(1, "John", TRUE)
	Call MyEndSub
End Sub	
Console
Displays output (printexpressions) on the server console.
This command is identical to the Print command, except that output is directed to the server console instead of the FirstClass client's output window. If you also want to write output to the server's log file, use the Report command.
Syntax
Console [printexpression,printexpression]
Console [printexpression,printexpression]
For an explanation of this syntax, see the Print command.
Example
Console "Welcome to my application"
Console "Hello"; FCUserName
Console "the value of 'i' is";i
Const
Declares a user-defined constant.
Syntax 
Const constname = expression
Const constname As datatype = expression
You can assign any type of expression to the constant. You can also specify a data type. If you do not specify a data type, the data type of the assigned expression is used.
Example
Sub Main()
	Const MYSTRING = "Hello world"
End Sub
CopyFile
Copies a file on the FirstClass server from one location to another. It uses the host operating system to issue a copy from one location to another.
Syntax
CopyFile(FromPath, ToPath, TRUE/FALSE)
The third parameter determines whether or not the copy will overwrite an existing file.
Example
CopyFile ("C:\FCSERVER\FCS.OLD","C:\FCSERVER\FCS2.OLD",FALSE)
Debug
Prints text to the console window only when the program is run from the development environment.
The Debug command acts exactly like the Print keyword except that it is not executed when the built application is run, but is activated when run from the development environment. This is useful to prevent users from seeing debugging information after you build and release the application.
Syntax
Debug StringToSend
Example
Sub Main()
	Print "This string will always be printed"
	Debug "This string only shows up when run from the development environment"
End Sub
Dim
Declares a variable and allocate storage memory.
Syntax
Dim varname As vartype
Dim varname(arrayupperbound) As vartype
Dim varname(arraylowerbound To arrayupperbound) As vartype
Dim varname As String * length
Dim varname1 As vartype, varname2 As vartype...
The variable name (varname) can be any valid alphanumeric string, as long as it does not begin with a decimal number (0-9) or an underscore (_). Underscores and decimal numbers are allowed in any other location in the variable name.
You must specify the variable type (vartype). Valid types are Integer, Long, Single, Double, Date, Currency, String, and user-defined types.
You can create arrays (array...bound) of variables of up to 61 dimensions, with no more than 1,000,000 elements. You can also declare a string variable of a fixed length (length). The length argument can be any valid number that indicates the maximum length of the string.
Example
Dim i As Integer
Dim MyArray(10) As Integer			'declare an integer array of 10 elements (0-9)
Dim MyArray(0 To 9, 0 To 9) As Double 	'declare a two-dimensional array
Dim str2 As String * 100 				'declare a fixed-length string of 100 characters
Do...Loop
Executes a group of subcommands while a conditional expression is TRUE or until a conditional expression evaluates to TRUE.
Syntax
Do While condition commands...Loop
Do Until condition commands...Loop
Do commands...Loop While condition
Do commands...Loop Until condition
When a loop reaches its last subcommand, the conditions (condition) of the loop are re-evaluated. The loop then either iterates or processing continues at the first line after the loop. There are four types of Do...Loops (Do While...Loop, Do Until...Loop, Do...Loop While, Do...Loop Until). Each serves a different purpose. The main difference between the two While and Until loops is in the location of the condition. Do...Loop...condition commands always execute the subcommands at least once, even if the condition indicates that the loop should not iterate. Do While/Until condition...Loop commands only execute the subcommands if the condition indicates that the loop should iterate. Loops using While iterate while the condition is TRUE. Loops using Until iterate until the condition evaluates to TRUE.
Example
Do While Score < 10
	Print Score
	Loop
Do
	Print Score
	Loop Until Score > 10
Both loops accomplish the same result.
DoEvents
Interrupts a currently running subroutine to process pending user input.
Use DoEvents to develop applications that respond to user input while the application loops, and to monitor data or update values on the form.
Syntax
DoEvents (starttime, endtime)
Example
Sub Click ()
	Dim StartTime as integer
	LastTime as integer
	Dim IconNumber as integer
	
	Randomize
	StartTime = Timer
	
	Do While (Timer < StartTime + 60)
'run loop for 60 seconds
		If Timer > LastTime + 1 Then
'every second, run this code
		IconNumber = Int ( (9 * Rnd) +1)	
'Generate 1 of 9 random icons
		DisplayIcon(IconNumber)
	End If
	DoEvents '**Call DoEvents to process pending input**
	Loop
End Sub
End
Ends a structure or procedure.
This command is required to end Sub, Function, Select, and Type structures. It is also required to end If structures unless the If command is all on one line. An End command used by itself stops execution of the application.
Syntax
End
End Sub
End Function
End If
End Select
End Type
Example
If StartupString = "Box" Then
	Print "Take the box to the curb"
	End
End If
Erase
Clears and reinitializes the values of an array.
All elements of a numeric array are set to zero. All elements of a string array are set to empty strings (''''). Arrays of date values are set to day zero. If the array is of a user-defined type, each member of the type is treated as its own separate variable and is erased in accordance with its type.
Syntax
Erase array
Erase array1, array2...
Example
Sub Main()
	Dim MyArray(1 to 10) As Integer
	Dim I As Integer
	Print "Assigning and Printing My Array"
		For I = 1 to 10
			MyArray(i)=i
			Print MyArray(i)
	Next i
	Erase MyArray		'All values from array MyArray are now zero
	Print "MyArray has been erased and now contains:"
		For i = 1 to 10		'Prints all zeros
	Print MyArray(i)
	Next i
End Sub
Exit
Ends a procedure or loop structure.
In the case of a procedure, processing moves to the line after the procedure call. In the case of a loop structure, processing moves to the line following the loop.
Syntax
Exit
Exit Sub
Exit Function
Exit Loop
Exit For
Example
See code example for the For...Next BASIC command.
For...Next
Executes a group of commands for each increment of a counter.
Syntax
For counter = start To end
subcommands
Next

For counter = start To end
commands
Next counter

For counter = start To end Step increment
subcommands
Next

For counter = start To end
subcommands
condition
Exit For

subcommands
Next
Each time a For...Next loop is iterated, the counter is incremented. You specify start and end values to indicate the initial and final values of the loop counter. The default increment is 1; however, you can specify a different increment by adding the Step keyword. The increment can be any valid number. If the increment is negative, the counter will count backwards from start to end. This is the only case where start is greater than end. You can also stop loop processing prematurely if a condition is met by using the Exit BASIC command.
Example
Dim i As Integer
For i = 1 to 10
	If i > 5 Then
		Exit For 	'This will break the loop prematurely.'
	End If
		Print "Counting:", i
	Next i
Next i
Function
Declares a procedure as a function capable of returning a value when it is called.
The name of the function is treated as a variable from within the function and the value will be returned when the function returns. Functions can be of any type and can call other procedures and internal functions to process the result.
Syntax
Function FunctionName(ParameterToFunction As DataType) as DataType
Example
Function MultiplyByTen(X as Integer)
as Integer
	MultiplyByTen=MultiplyByTen*10
End Function
Sub Main
	Print"Eight times ten is "& MultiplyByTen(8)
End Sub
GiveTime
Suspends application processing and allows the server to re-enter. 
All applications are given about the same amount of processing time. If an application knows that it does not need all of its allotted time, it can use GiveTime to give up the remainder of its time to other server processes and applications. All database and field operations, and some commands, initiate their own server re-entrance. In these cases, there is no need to call the GiveTime command.
This is a useful command for applications that are sometimes idle (for example, polling at set times).
Syntax
GiveTime
Example
starttime = Timer
Do While TRUE
	If Timer < starttime + 5 Then
	Give Time
Else 
	Print "5 seconds have elapsed..."
	starttime = Timer
End If
Loop
Gosub...Return
Jumps to a procedure's labeled subroutine, then returns to the line following Gosub.
Note
We do not recommend use of this command; it is only included for backward compatibility. Instead, use subroutines to handle frequently processed routines. Processing jumps to the line that starts with the label. The label can be either a line number (consisting of the numbers 0-9) or an alphanumeric string (as long as it does not start with a number).
Syntax
Gosub label
...
Return 
The label must be the first nonblank characters on the line followed by a colon (:).
Example
Dim I As Integer
	For I = 1 to 10
		Gosub MySubroutine
		Goto MyEnd
Goto
Jumps to a label.  Processing jumps to the line that starts with the label. The label can be either a line number (consisting of the numbers 0-9) or an alphanumeric string (as long as it does not start with a number).
Syntax
Goto label
The label must be the first nonblank characters on the line followed by a colon (:).
Example
Sub Main()
	Dim num As Integer
	num = 5
	Goto 20
		Print "This will not get printed"
	20 If num = 5 then
	Goto numis5
...
If...Then
Branches processing based on a condition. 
This command requires a condition that must be TRUE or FALSE. Any numeric condition that is not TRUE is considered to be FALSE. When the condition is TRUE, the commands following this statement are executed, then processing continues on the line following End If. 
Syntax
If condition Then command1 Else command2
If condition Then
commands
End If

If condition1 Then
commands
ElseIf condition2 Then
commands
Else
commands
End If
You can include any number of ElseIf...Then clauses with a block If...Then structure to specify additional conditions.
Example
If FCUserid = "guest" Then 
	Print "Welcome Guest User"
ElseIf FCUserid = "admin" Then
	Print "Welcome Administrator"
Else
	Print "Welcome"		'user is neither a guest nor administrator
End If
Let
Precedes a variable assignment. It assigns values to variables. It is optional in the BASIC language.
Syntax
Let VariableName = Value
Example
Let X=1
X=1
Load
Loads a form's fields and data resources.
This command makes a form's field and data resources available to the application, but does not make the form visible. To display a form, you must use the Show form method.
Syntax
Load formname
Example
Sub Main()
	Load MyForm
	If MyForm.MyTable.Column(1) = TRUE Then
		MyForm.Title = "My Form's Title"
		MyForm.Show
	End If
End Sub
MsgBox
Displays a modal message box.
Because this is a modal message box, processing for this application is suspended until the user responds by clicking a button in the message box. At that time, processing continues with the line following the MsgBox command. 
Use the MsgBox Response function to tell the application which button the user clicked.
Syntax
MsgBox("msgboxstring")
MsgBox("msgboxstring", msgboxbuttons)
MsgBox("msgboxstring", msgboxbuttons, "msgboxtitle")
MsgBox strings are now truncated at 509 characters. You specify the string to appear in the message box (msgboxstring). You can also add a title to the message box (msgboxtitle), and can specify which buttons you want in the message box (msgboxbuttons). Valid values for msgboxbuttons are:
•	fcOKOnly - OK button only
•	fcOKCancel - OK and Cancel buttons
•	fcYesNo - Yes and No buttons
•	fcYesNoCancel - Yes, No, and Cancel buttons.
If you do not specify a title, none appears. If you do not specify message box buttons, just the OK button appears.
Example
MsgBox ("Would you like to save changes?", FCYesNoCancel, "Save")
On Error
Enables or disables error handling.
Syntax
On Error Goto label
On Error Resume
On Error Resume Next
On Error Goto 0
This command is used with the following commands:
•	Goto label
Processing jumps to the line that starts with the label if a critical error occurs. The label can be either a line number (consisting of the numbers 0-9) or an alphanumeric string (as long as it does not start with a number). The label must be the first nonblank characters on the line followed by a colon (:).
•	Resume
The application will try to re-execute the line that caused the error until it executes successfully. Be careful about using this command, because the application could loop on this line indefinitely.
•	Resume Next
Processing resumes with the line after the line that caused the error, including critical errors. Any lines that cause errors are skipped, and processing does not stop for critical errors. 
•	Goto 0
Turns off error handling from this point on.
Example
Sub Main()
	Dim i As Integer
	On Error Goto ErrHandler
	i=1/0		'division by zero error
		Print "Error handling has resumed execution here"
Exit Sub
Option
Sets BASIC interpreter options for this application.
Syntax
Option Base index
Currently, you can only set one option: Base. This option indicates the default index for the first element of arrays with default lower bounds declared with Dim. The index can be 0 (the default) or 1. Option Base must be called from the Declarations procedure of a code module, and can only be called once per application.
Example
Option Base 0
...
Dim MyArray(10) As Integer	'creates a 10-element array indexed from 0 to 9

Option Base 1
...
Dim MyArray(10) As Integer 	'creates a 10-element array indexed from 1 to 10
PlaySound
Plays a FirstClass client sound resource.  You must specify the resource ID of the FirstClass sound resource.
Syntax
PlaySound(ResourceID)
Print
Displays output (printexpressions) to the FirstClass client's output window.
Syntax
Print
Print printexpression
Print printexpression, printexpression
Print printexpression; printexpression
Print,
Print;
One Print command can output any number of expressions. To specify a string as an expression, enclose it in double quotes ("string"). You can use the following characters with this command:
•	comma (,) between expressions
	Causes each expression to appear in the print zone following the previous expression. Print zones are located every 14 characters.
•	semicolon (;) between expressions
	Causes each expression to appear immediately after the previous expression.
•	comma (,) or semicolon (;) at end of line.
	Suppresses the carriage return that is normally output at the end of the output for each Print command line. Any subsequent Print command output will appear on the same line.
A print Command without a printexpression outputs a carriage return.
Example
Print "Welcome to my application"
Print 1, 2, 3, 4, 5 		'prints each number in a separate print zone
Print "These two lines are ";
Print "output as one."
Randomize
Initializes the random number generator.
If you do not use this command, the Rnd function will return the same list of random numbers every time it is run.
Syntax
Randomize [seed]
You can specify the numeric key from which to generate the random number list by using the seed argument. If you use the same value for seed each time a program is run, the same list of random numbers will be generated. If you do not include the seed argument, Randomize generates the random number list using the Timer function.
Example
Dim i As Integer
Randomize 
Print "Generating 5 random numbers"
For i = 1 to 25
ReDim
Changes the number of elements in an array.
Using this command on an existing array will replace the old array dimension with the new one.
Syntax
ReDim varname As vartype
ReDim Preserve varname As vartype
ReDim varname (arrayupperbound) As vartype
ReDim varname (arraylowerbound To arrayupperbound) As vartype
ReDim varname1 As vartype, varname2 As vartype...
For an explanation of this syntax, see Dim.
To keep existing values in an array, include the Preserve keyword. If you do not include this keyword, the array is erased as if the Erase command had been used on it.
Example 
ReDim Preserve MyArray (MAXVAL+1) As Integer
Rem
Comments out a line of text. The entire line is ignored.
Syntax
Rem comment
'comment
Example
Rem This is a comment	'This is a comment
Report
Writes output (printexpressions) to the server's log file.
This command is identical to the Print command, except that output is directed to the log file and server console instead of the FirstClass client's output window.
If you just want to display output on the server console, use the Console command.
Syntax
Report
Report printexpression
Report printexpression, printexpression
Report printexpression; printexpression
Report,
Report;
For an explanation of this syntax, see the Print command.
Example
Report "Application began at:"; Now 
RunApp
Runs a built and loaded application in a new application environment space. 
Syntax
RunApp("appname")
RunApp("appname", "startupstring")
You specify the application name (appname) with this command. You can also specify any valid string expression as a startup string (startupstring). This string is passed to the launched application as the StartupString value in the launched application.
Example
RunApp("Calc")			'Launches the Calc application
RunApp("Order", "buy12")	'Launches the Order application with the startup string "buy 12"'
Select Case
Builds an expression-based conditional branching of programmatic flow.
Syntax
Select Case testexpression
	[Case [Is | # To # ] expressionlist [commands]]
	[Case Else] [commands]]
End Select
The Select Case selection structure provides a simplified method for comparing an expression or conditional command to a series of possible expressions or 'cases'.
If the Case is TRUE, the commands following the case are executed. Each case in the selection structure is executed accordingly. Each Select Case selection structure must end with the keywords End Select.
Is and To keywords provide a method for making comparisons within a Case command. Is allows you to use comparison operators while the To keyword allows you to compare and test a range of values for an expression.
Sleep
Halts execution of the program until a specified time has elapsed.
The program can still be unloaded from the server or stopped by closing the form in the case of a stationery-launched application. The Sleep command is of particular use in server applications, where you don't want to consume large amounts of the server CPU calling the program, but want to execute some code on an occasional basis.
Syntax
Sleep(seconds|date)
The parameter can either be an integer, in which case it specifies the number of seconds to sleep before continuing, or the date, in which case the program will not continue until the specified time and date are reached.
Example
Print "This program will self destruct in five seconds!"
Sleep (5)
End
Sort
Sorts a one dimensional array into ascending or descending order.
Syntax
Sort(array)
Using the optional fcAscending and fcDescending parameters, the Sort command can sort arrays of type Integer, Long, Date, String, Single, Double, or Currency, in any order.
Sub
Declares the name and arguments for a sub procedure.
Syntax
Sub name ([ByRef | ByVal] [arg1],[ByRef | ByVal] arg2]...)
The argument name can be any string that is a valid BASIC identifier and cannot begin with underscore characters or decimal digits (0-9). 
A Sub can receive any number of arguments. The Sub argument arg can be any valid BASIC identifier and be of any type. 
If the keyword ByRef is used, the argument is passed by reference. If the keyword ByVal is used, the argument is passed by value. If no keyword is specified, the default behavior for arguments is passed by value.
Example
Sub DisplayMyUserInfo()
	Print "My UserID is "; FCUserID
End sub
Type
Declares a user defined type.
User-defined data types help organize data by making it possible to combine several related variables into a single data structure.
If a user-defined type is defined in the Declarations section of a code module, the type will be visible to the entire application and will remain for the lifetime of the application. If defined in a procedure, the type is only visible to the procedure and will remain only for the lifetime of the procedure.
Syntax
Type typename
	varname As datatype
	[varname As datatype...]
End Type
Example
Type CustType		'defined in Declarations
	First as String
	Last as String
	SSNum as String *9	'where *9 is a limit to the variable
	CustomerID as Integer
End Type
Unload
Closes a form and shuts down its data environment.
Syntax
Unload formname
The Unload command closes the form indicated by the string expression formname. Upon closing, the form runs its Unload event procedure and shuts down the open tables in its data environment.
Example
Sub Click()
	Unload MyForm
End Sub
While...Wend
Executes a group of commands while a conditional expression evaluates to TRUE.
The While...Wend loop structure is similar to the Do...Loop structure, but is more limited. The While...Wend structure is included for backward compatibility.
Syntax
While condition
	commands
Wend
Language reference contents
BASIC operators
&
Concatenates two strings (s1 and s2). 
String concatenation adds the second string to the end of the first and returns this as a result string.
Syntax 
s1 & s2
Example
Sub Main()
	Dim s1 as String, s2 as String, result as String
	s1 = "Hello" : s2 = "world"
	result = s1 & s2
		Print result 	'result is assigned 'Hello world'
		Print result	'prints Hello world
End Sub
*
Multiplies two numbers (n1 and n2).
Syntax
n1 * n2
n1 and n2 can be any valid numeric expression.
Example
Sub Main()
	Print "10 times 4 is:", 10 * 4
End Sub
+
Adds two numbers (n1 and n2) or concatenates two strings (although we recommend & for concatenation).
Syntax
n1 + n2
n1 and n2 can be any valid numeric expressions.
Example
Sub Main()
	Print "The sum of 10 and 4 is:", 10 + 4
End Sub
-
Subtracts two numbers (n1 and n2) or negates the value of a number (n).
Subtraction syntax
n1 - n2
n1 and n2 can be any valid numeric expressions.
Subtraction example
Sub Main()
	Print "10 minus 4 is:", 10 - 4
End Sub
Negation syntax
-n
Negation example
Sub Main()
	Print "negated 99 is:", -99
	Print "negated -99 is:", -(-99)
End Sub
/
Divides two numbers (n1 and n2), when you want the result expressed as a floating point value.
Syntax
n1 / n2
n1 and n2 can be any valid numeric expressions. 
Example
Sub Main()
	Print"10 divided by 4 is: ", 10/4		'prints 2.5
End Sub
\
Divides two numbers (n1 and n2).
The dividend will be truncated and the result will be expressed as an integer value without a remainder.
Syntax
n1\n2
n1 and n2 can be any valid numeric expressions.
Example
Sub Main()
	Print "10 divided by 4 is:", 10\4 	'prints 2
End Sub
< (less than)
Compares the values of two expressions (e1 and e2) of the same or similar types. 
If e1 is less than e2, TRUE is returned; otherwise, FALSE is returned.
Syntax
e1 < e2
Example
If num < 5 Then
	Print "The value of 'num' is less than 5"
<= (less than or equal to)
Compares the values of two expressions (e1 and e2) of the same or similar types. 
If e1 is less than or equal to e2, TRUE is returned; otherwise, FALSE is returned.
Syntax
e1 <= e2
Example
If num <= 5 Then
	Print "The value of 'num' is less than or equal to 5"
<> (not equal)
Compares the values of two expressions (e1 and e2) of the same or similar types. 
If the values are different, TRUE is returned; otherwise, FALSE is returned.
Syntax
e1 <> e2
Example
Sub Main()
	Dim num as Integer
	num = 5
	If num <> 5 Then
		Print "The value of 'num' is not equal to 5"
Else 
	Print "The value of 'num' is equal to 5"
	End If
End Sub
=
Compares the values of two expressions (e1 and e2) of the same or similar types. 
If the values are the same, TRUE is returned; otherwise, FALSE is returned.
Syntax
e1 = e2
Example
Sub Main()
	Dim num as Integer
	num = 5
If num = 5 Then
	Print "The value of 'num' is equal to 5"
> (greater than)
Compares the values of two expressions (e1 and e2) of the same or similar types. 
If e1 is greater than e2, TRUE is returned; otherwise, FALSE is returned.
Syntax
e1 > e2
Example
Sub Main()
	Dim num as Integer
	num = 5
	If num > 5 Then
		Print "The value of 'num' is greater than 5"
	Else
		Print "The value of 'num' is less than or equal to 5"
	End If
End Sub
>= (greater than or equal to)
Compares the values of two expressions (e1 and e2) of the same or similar types. 
If e1 is greater than or equal to e2, TRUE is returned; otherwise, FALSE is returned.
Syntax
e1>= e2
Example
If num >= 5 Then
	Print "The value of 'num' is greater than or equal to 5"
AND
Evaluates whether two expressions (e1 and e2) are TRUE. 
Both expressions must be TRUE for the AND result to be TRUE.
Syntax
e1 AND e2
Example
Sub Main()
Dim e1 as Integer, e2 as Integer e1 = TRUE: e2 = 5< 34
	If e1 AND e2 Then
		Print "Both expressions are TRUE"
	Else
		Print "Neither expression is TRUE"
	End If
End Sub
MOD
Returns the remainder from the division of two numbers (n1 and n2), expressed as an integer.
Syntax
n1 MOD n2
n1 and n2 can be any valid numeric expressions. 
Example
Sub Main()
	Print "The remainder from 10 divided by 4 is:", 10 MOD 4		'prints 2
End Sub
NOT
Evaluates whether an expression (e) is FALSE.
Syntax
NOT e
Example
Sub Main()
	Dim e1 as Integer
	e1 = TRUE
	If NOT e Then
		Print "Expression 'e' was FALSE" 	
		'NOT TRUE=FALSE
	Else 
		Print "Expression 'e' was TRUE"
	End If
End Sub
OR
Evaluates whether one or both of two expressions (e1 and e2) are TRUE. 
Only one of the expressions needs to be TRUE for the OR result to be TRUE. 
Syntax
e1 OR e2
Example
Sub Main()
	Dim e1 as Integer, e2 as Integer
e1 = TRUE : e2 = 5 < 34
	If e1 OR e2 Then
Print "Either one or both expressions are TRUE"
	Else
	Print "Both e1 and e2 do not evaluate to TRUE"
	End If
End Sub
XOR
Evaluates whether only one of two expressions (e1 and e2) is TRUE. 
One expression must be TRUE and the other must be FALSE for the XOR result to be TRUE. 
Syntax
e1 XOR e2
Example
Sub Main()
	Dim e1 as Integer, e2 as Integer
	e1 = TRUE: e2 = 5 < 34
If e1 XOR e2 Then
		Print "Only one expression, e1 or e2, is TRUE"
	Else
		Print "Both e1 and e2 are TRUE or Both e1 and e2 are FALSE"
	End If
End Sub
^
Raises a number (n1) to the power of a second number (n2). 
For example, raising a number to the power of 2 gives the square of the number. 
Syntax
n1^n2
Example
Sub Main()
	Print "10 squared is:", 10^2
	Print "4 cubed is:", 4^3
	Print "6.4 to the power of 1.5 is ", 6.4^1.5
End Sub
Language reference contents
BASIC variables
Currency
Used for variables that contain monetary data. This data type uses a fixed decimal point and supports up to 15 digits to the left of the decimal and 4 digits to the right.
This is a superior data type for monetary calculations because the Single and Double data types are subject to small rounding errors.
Acceptable values
-922337203685477.5808 to 922337203685477.5807
Date
Used for variables that contain date data in a valid date format such as 1/1/2000 or January 1, 2000, as well as time data.
Note
You can also use numeric data types for dates. If you do this, values to the left of the decimal represent the days from December 30, 1899. Values to the right of the decimal represent time as a fraction of a day (for example, 12:00 PM is represented as .5).
Acceptable values
January 1, 100 to December 31, 9999
DBConnection
Creates a database connection object.
DBConnection has its own set of attributes and methods.
DBStatement
Creates a database statement object.
DBStatement has its own set of attributes and methods.
Double
Used for variables that can contain any numeric value, including fractions and numbers of high decimal precision. This data type is less efficient than the Integer and Long data types, but more flexible.
The Single data type has the same constraints and size limits as Double. You can use these data types interchangeably. FirstClass RAD treats the traditionally smaller Single data type as a Double to support legacy BASIC code.
Acceptable values
-1.79769313486231E308 to  1.79769313486231E308
Email
Creates an email object.
Email has its own set of attributes and methods.
File
Creates a file object.
File has its own set of attributes and methods.
Integer
Used for integer data types. See the Long data type for more information.
Range
-2,147,483,648 to 2,147,483,647
Long
Used for variables that never contain fractions. This data type is smaller and more efficient than numeric data types that can contain fractions.
The integer data type has the same constraints and size limits as Long. You can use these data types interchangeably. FirstClass RAD treats the traditionally smaller Integer data type as a Long to support legacy BASIC code.
Acceptable values
-2,147,483,648 to 2,147,483,647
String
Used for variables that contain text strings.
By default, string lengths are variable; however, you can enforce a specific length by using a fixed length String variable. Shorter strings are allowed and are not padded. The length limit is only enforced when the string is longer than the limit.
To make a String variable a fixed length, append an asterisk (*) and a whole number, representing the maximum number of characters, to the String keyword. Strings that are longer than the maximum are truncated.
Acceptable values
0 to approximately 65,500 characters
Example
Dim LastName As String * 7
Single
Used for single data types. See the Double data type for more information
Range
1.7E +/- 308 (15 digits)
Language reference contents
Column attributes
ColNum
Retrieves the column's ordinal number in the table.
This attribute is read only at runtime.
Syntax
tablename.column(columnid).ColNum
Data
Retrieves or assigns the value of binary data columns. The data attribute contains binary data which, in most instances, may be manipulated as a string.
Syntax
tablename.column(columnid).Data
Datatype
Retrieves the column's data type. It contains a constant integer value indicating the data type of the column. 
This attribute is read only at runtime.
Syntax
tablename.column(columnid).Datatype [constant]
These are the possible values for constant:
•	fcString - character or text data
•	fcInteger - long integer numeric data
•	fcLong - long Integer numeric data
•	fcSingle - double floating point numeric data
•	fcDouble - double floating point numeric data
•	fcCurrency - currency data
•	fcDate - date and time data
•	fcBinary - binary data.
Name
Retrieves the column's database identifier.
This attribute is read only at runtime.
Syntax
tablename.column(columnid).Name
Nullable
Returns whether or not the column can be null.
This attribute is read only at runtime.
Syntax
tablename.column(columnid).Nullable
Precision
Retrieves the column's (or parameter's) maximum number of digits used by the data type of the column or parameter. This attribute is read only at runtime.
Note
For character types, this is the length in characters of the data; for binary data types, column size is defined as the length in bytes of the data. For the time, timestamp, and all interval data types, this is the number of characters in the character representation of this data.
Syntax
tablename.column(columnid).Precision
Scale
Retrieves the maximum number of digits to the right of the decimal point for the column.
This attribute is read only at runtime.
Note
For approximate floating point number columns or parameters, the scale is undefined, since the number of digits to the right of the decimal point is not fixed. For datetime or interval data that contains a seconds component, the decimal digits is defined as the number of digits to the right of the decimal point in the seconds component of the data. 
For the SQL_DECIMAL and SQL_NUMERIC data types, the maximum scale is generally the same as the maximum precision. However, some data sources impose a separate limit on the maximum scale. 
Syntax
tablename.column(columnid).Scale
Text
Retrieves or assigns the text string of the column on the current row. Text may also contain date information.
Text and Value are the default attributes for columns.
Syntax
tablename.column(columnid).Text
Value
Retrieves or assigns the numeric value of the column on the current row. Value may also contain date information.
Text and Value are the default attributes for columns.
Syntax
tablename.column(columnid).Value
Language reference contents
Connection attributes
AutoCommit
Specifies whether to use auto-commit or manual-commit mode.
Syntax
connectionname.AutoCommit [= constant]
These are the possible values for constant:
•	SQL_AUTOCOMMIT_OFF
The connection uses manual-commit mode. The application must explicitly commit or roll back a transaction with the Commit or Rollback methods.
•	SQL_AUTOCOMMIT_ON
The driver uses auto-commit mode. Each command is committed immediately after it is executed.
•	SQL_AUTOCOMMIT_DEFAULT.
Autocommit On. 
If no value for constant is assigned, the default depends on the settings in your ODBC setup. Changing from manual-commit mode to auto-commit mode commits any open transactions on the connection.
AccessMode
Retrieves or assigns an integer value indicating the ODBC access mode of a connection.
Syntax
connectionname.AccessMode [= constant]
These are the possible values for constant:
•	SQL_MODE_READ_WRITE
Connections may process any read or write requests submitted.
•	SQL_MODE_READ_ONLY
Connections will be instructed not to process requests which are not read-only; the behavior of the data source and ODBC driver which receive such requests is defined by the implementation.
•	SQL_MODE_DEFAULT.
Read-write access mode. 
The default value for this attribute is SQL_MODE_READ_WRITE.
CurrentQualifier
Specifies the concurrency attribute, which is a string containing the SQL command qualifier to be used by the data source.
Syntax
connectionname.CurrentQualifier [= qualifier]
For some databases the qualifier string might indicate a database to access, or in the case of some file-based data sources, a directory where table files are stored. Either can be specified.
ODBCCursors
Specifies how the connection will use the ODBC cursor library.
Syntax
connectionname.ODBCCursors [= constant]
These are the possible values for constant:
•	SQL_CUR_USE_IF_NEEDED
The connection uses the ODBC cursor library only if it is needed. If Move and Find methods are not supported by the ODBC data source, the ODBC driver manager will attempt to emulate them.
•	SQL_CUR_USE_ODBC
The connection uses the ODBC cursor library.
•	SQL_CUR_USE_DRIVER
The connection uses the cursors and scrolling capabilities of the driver. Move and Find methods are driven using the data source's cursor model.
•	SQL_CUR_USE_DEFAULT.
Use driver-driven cursors.
The default value for this attribute is SQL_CUR_USE_DRIVER.
LoginTimeout
Specifies an integer value indicating the number of seconds to wait for a login request to complete. The default is data source-driver dependent and is always a non-zero integer. If LoginTimeout is assigned 0, the timeout is disabled and a connection will wait indefinitely while attempting to log in. 
Syntax
connectionname.LoginTimeout [= logintimeout]
The default login timeout for the connection is SQL_LOGIN_TIMEOUT_DEFAULT.
OptTraceFile
Specifies the name of the ODBC trace file.
Syntax
connectionname.OptTraceFile [ = filename]
filename can be any valid string expression that is a valid file system path.
OptTrace
Specifies an integer value indicating whether the ODBC Driver Manager performs tracing.
Syntax
connectionname.OptTrace [= constant]
These are the possible values for constant:
•	SQL_OPT_TRACE_OFF - tracing off
•	SQL_OPT_TRACE_ON - tracing on
•	SQL_OPT_TRACE_DEFAULT - tracing off.
An application specifies a trace file with the OptTraceFile attribute. If the file already exists, the ODBC Driver Manager appends to the file. If the trace file does not exist, the ODBC Driver Manager creates the file. If no tracing file has been specified, the ODBC Driver Manager writes to the file \SQL.LOG. 
The default value for this attribute is SQL_OPT_TRACE_OFF, which indicates that no ODBC tracing will occur.
PacketSize
An integer value that specifies the network packet size in bytes.
Note
Many data sources do not support this attribute.
Syntax
connectionname.PacketSize [= size]
TranslateDLL
Specifies the name of the DLL containing ODBC translation functions.
Syntax
connectionname.TranslateDLL [= DLLname]
DLLname can be any valid string expression that is a valid file system path to the translation DLL file. The translation DLL provides a facility for implementing additional translation functionality, including character set translation.
QuoteChar
Retrieves the data source-specific quote character.
This attribute is read only at runtime.
Syntax	
connectionname.QuoteChar
TxnIsolation
Retrieves or assigns an integer value indicating the ODBC transaction isolation level.
The following definitions and behaviors are defined in ODBC:
•	Dirty Read
Transaction1 modifies a row and Transaction2 reads the modified row before Transaction1 commits the change. If Transaction1 rolls back the change, Transaction2 will have read a row that should have never existed.
•	Nonrepeatable Read
Transaction1 reads a row and Transaction2 updates or deletes that row and commits this change. If Transaction1 rereads the row, it will receive different values or discover that the row no longer exists.
•	Phantom
Transaction1 reads a set of rows that satisfy some search criteria. Transaction2 inserts a row that matches the search criteria. If Transaction1 re-executes the query that reads the rows, it receives a different set of rows.
Syntax
connectionname.Txnlsolation [= constant]
These are the possible values for constant:
•	SQL_TXN_READ_UNCOMMITTED
Dirty reads, nonrepeatable reads, and phantoms are possible.
•	SQL_TXN_READ_COMMITTED
Dirty reads are not possible. Nonrepeatable reads and phantoms are possible.
•	SQL_TXN_REPEATABLE_READ
Dirty reads and nonrepeatable reads are not possible. Phantoms are possible.
•	SQL_TXN_SERIALIZABLE
Transactions are serializable. Dirty reads, nonrepeatable reads, and phantoms are not possible.
•	SQL_TXN_VERSIONING.
Transactions are serializable, but higher concurrency is possible than with SQL_TXN_SERIALIZABLE. Dirty reads are not possible.
Language reference contents
Connection methods
BrowseConnection
Calls against an ODBC driver or data source to determine which arguments are required to connect.
Information is returned in the connection's ConnectionString property, and is useful when connecting to an ODBC database for the first time. This same information states what data is required to establish a connection. The normal connection method used in FirstClass RAD is OpenConnection, which takes the three arguments for normal data sources.
Syntax
connectionname.BrowseConnection(string) 
Most ODBC data sources have a maximum of three arguments for string (dsn, userid, and password). Oracle and other enterprise databases may require a minimum of four arguments for string (dsn, userid, password, and connection string).
Example
Dim cnct as dbConnection
cnct.BrowseConnection ("DSN=ORACLE") 'Oracle data source
Print cnct.ConnectionString
UID:Login=?,PWD:Password=?;ConnectString: Connection String=?; 
'string returned from the driver indicating which parameters are required
REM
'the format of the string returned from the driver indicating which parameters are required is (KEYWORD:DESCRIPTION=VALUE)
CloseConnection
Closes a connection on an ODBC data source. All open statements on the connection will automatically be closed.
Syntax
connectionname.CloseConnection
Example
See the code example for the OpenConnection connection method.
Commit
Commits a transaction on a data source.
Note
This method is only available to data sources that support transactions. Commit is not a valid operation for connections that have the AutoCommit attribute turned on.
Syntax
connectionname.Commit
Example
Sub Main()
	Dim cnct as DBConnection
	cnct.OpenConnection("MyDSN")	'Open the data source "MyDSN"
	cnct.AutoCommit = SQL_AUTOCOMMIT_OFF	
'Begin the transaction
	' Create statements and execute SQL...
	' ...
If (UserClickedCancel = TRUE)
	cnct.Rollback		'Rollback changes
Else
	cnct.Commit		'Commit changes
End if
	cnct.CloseConnection	'Close the connection	
End Sub
DriverConnection
Establishes a data source with the raw ODBC connection information. This is the information returned by BrowseConnection.
Note
If you have built a bound columns application (using table and connection FirstClass RAD objects instead of code) with a different database, and you would like to migrate to Oracle, you must do the following:
1	set the establish connections selection list to manual startup
2	run something similar to the DriverConnection code example (below) to connect to the database in your Sub Main()
3	match the table and column names in the Oracle database to the names in your previous project (or the migration will not work).
Syntax
connectionname.DriverConnection(connection) 
where connection specifies a connection string for the ODBC driver.
Example
The following code can be used in a program to establish a live connection to the ORACLE data source, and allocate statements and run queries against it.
Dim cnct As dbConnection
cnct.DriverConnection("DSN=ORACLE;UID=admin;PWD=frisky;ConnectString=MyOracleServerString")
OpenConnection
Opens an ODBC data source connection.
Note
This method must be run on any DBConnection object prior to opening statements and executing database operations.
Syntax
connectionname.OpenConnection(DSN[,login] [,password])
The DSN argument accepts any string expression that specifies a valid data source name as configured in the ODBC Data Source Administrator. The optional login and password arguments accept any string expressions that specify the data source login and password respectively.
Example
Sub Main()
	Dim cnct As DBConnection
	cnct.OpenConnection("MyDSN") 
'Open the data source "MyDSN"
' Create statements and execute SQL...
' ... 
	cnct.CloseConnection	
'Close the connection
End Sub
Rollback
Rolls back a transaction on a data source.
Note
This method is only available to data sources that support transactions. Rollback is not a valid operation for connections that have the AutoCommit attribute turned on.
Syntax
connectionname.Rollback
Example
See the code example for the Commit connection method.
Language reference contents
Email attributes
Body
Sets the body text for an email message.
This attribute is optional as body text is not required for an email message to be sent.
Syntax
emailvariable.Body [= string expression]
string expression can have any text value and is not limited to valid users on the system. 
Example
Sub Main()
	Dim MyMessage As Email
	...
	MyMessage.Body = "FCRAD demo, you are using too much disk space."
	MyMessage.Send
End Sub
From
Sets the sender's identity for an email message.
This attribute must be set or the email message will not be delivered.
Syntax
emailvariable.From [= string expression]
string expression can have any text value and is not limited to valid users on the system. 
Example
Sub Main()
	Dim MyMessage As Email
	...
	MyMessage.From = "Administrator"
	MyMessage.Send
End Sub
Subject
Sets the subject text for an email message.
This attribute is optional as subject text is not required for an email message to be sent.
Syntax
emailvariable.Subject [= string expression]
string expression can have any text value.
Example
Sub Main()
	Dim MyMessage As Email
	...
	MyMessage.Subject = "Too many files..."
	MyMessage.Send
End Sub
To
Sets the recipient's user name for an email message.
Note
The To attribute supports FirstClass mail lists, but does not currently support the use of gateways. If the user name is invalid, the email message will fail. This attribute must be set or the email message will not be delivered.
Syntax
emailvariable.To [= username]
username can be any user or conference name as long as the user has send privileges to the recipient.
Example
Sub Main()
	Dim MyMessage As Email
	...
	MyMessage.To = "FCRAD Demo"
	MyMessage.Send
End Sub
Language reference contents
Email methods
Send
Sends an email message.
If the To and From email attributes have not been set, an error occurs.
Syntax
emailvariable.Send
Example
Sub Main()
	Dim MyMessage As Email
	...
	MyMessage.From = "Administrator"
	MyMessage.Subject = "Welcome!"
	For i = 0 to 3
		MyMessage.To = Users(i)
		MyMessage.Body = "Welcome " & Users(i) & "your account has " _ & "been created."
		MyMessage.Send
Next i
End Sub
Language reference contents
Form attributes
Hidden
Shows or hides a form. This form attribute also can be used to determine the current state of a form; if the form is shown, the Hidden attribute is FALSE. Otherwise, the Hidden attribute is TRUE.
Syntax
[formname].Hidden [= TRUE|FALSE value]
Example
Sub Click()
	If MyForm.Hidden = TRUE Then
		MyForm.Title = "Form Title"
		MyForm.Show
	End If
End Sub
MouseX,MouseY
Retrieves the last X and Y coordinates clicked on the form body (including any protected controls).
Syntax
formname.MouseX
formname.MouseY
Example
Sub Main()
	MyForm.MouseX
	MyForm.MouseY
End Sub
Title
Displays the form's window title string.
Syntax
[formname].Title [=string expression]
The title can be assigned any valid string expression.
Example
Sub Click()
	MyForm.Title = "My form Title"
	MyForm.Show
End Sub 
Language reference contents
Form events
Activate
Activates an event on a form.
The event is triggered when the form is activated. A form is activated when the form receives focus.
Click
Clicks an event on a form.
The event is triggered when the user clicks on the form body or on a protected field on the form.
Deactivate
Deactivates an event on a form.
The event is triggered when the form is deactivated. A form is deactivated when the focus is set to another form.
DoubleClick
Double-clicks an event on a form.
The event is triggered when the user double-clicks on the form body or on a protected field on the form.
Load
Loads an event.
The event is triggered when the form is first loaded or shown. A form is loaded with the Load command or shown with the Show method.
Unload
Unloads an event.
The event is triggered when a form is closed, either by clicking the close box on the form or programmatically, using the Unload command.
Language reference contents
Form methods
DisableFormEvents
Disables the following form events:
•	Click
•	DoubleClick
•	Activate
•	Deactivate
and the following field events:
•	Click (except buttons)
•	DoubleClick
•	GotFocus
•	LostFocus.
This form method is useful for applications running on high usage systems. If the events listed are not used in the application, disabling these form events can reduce client-server overhead.
Syntax
formname.DisableFormEvents
EnableFormEvents
Enables form and field events disabled with the DisableFormEvents form method.
Syntax
formname.EnableFormEvents
Hide
Hides a form from view.
A hidden form is not unloaded; the form continues to exist with current attributes and values intact. Showing a hidden form will redisplay the form with all attributes set as they were prior to running the Hide form method. If the application ends, a hidden form is automatically unloaded.
Syntax
formname.Hide
Show
Displays a modeless form. If the form has not been loaded, Show will load the form and data environment before displaying.
Syntax
formname.Show
Swap
Hides a form's content and display a second form within the form's original window.
Syntax
formname.Swap(swapform)
The swapform argument can be any string expression that is a valid form name. This method allows the programmer to dramatically change the interface in the window without hiding and unhiding fields.
Be sure to put the swapform argument as a string and not a direct reference to the form object. If the swapform argument is a direct reference to the form object, the form's default attribute, Title, will be used as the swap form name. 
Example
	Form1.Swap("Form2)	'Correct!
	Form1.Swap(Form2)	'Incorrect! Passes Form2's title as an argument.
Language reference contents
Field attributes
Admin
Retrieves or assigns the Admin attribute of a field. This attribute allows the administrator to view and modify a field that is Hidden or Protected. 
Note
This attribute has been deprecated. To emulate this functionality, get the user's user ID from the FCUserID function and set the Protected and Hidden attributes explicitly.
Syntax
[formname].fieldname.Admin [= TRUE/FALSE value]
Bold
Displays field text in bold.
Syntax
[formname].fieldname.Bold [= TRUE/FALSE value]
Border
Displays a border around a field. If this field attribute is set, only buttons will trigger a click event for the field.
Syntax
[formname].fieldname.Border [= TRUE/FALSE value]
Bottom
Displays field text aligned with the bottom boundary of the field.
Syntax
[formname].fieldname.Bottom [= TRUE/FALSE value]
Caption
Retrieves or assigns the text caption for nontext fields. This attribute is often used to set the text on button fields.
Syntax
[formname].fieldname.Caption [=string expression]
Center
Displays field text centered between the top and bottom boundaries of the field.
Syntax
[formname].fieldname.Center [= TRUE|FALSE value]
Color
Displays the field text in the default color.
Syntax
[formname].fieldname.Color [= TRUE|FALSE value]
Condense
Displays field text in condensed text style. 
Note
The condensed text style is not available on the Windows client; it is only available on the Mac OS client.
Syntax
[formname].fieldname.Condense [= TRUE|FALSE value]
CreationDate
Retrieves the file CreationDate attribute of a file viewer field.
Syntax
[formname].fieldname.CreationDate
Data
Retrieves or assigns a field's binary data. The binary data can, in most instances, be manipulated as a string. 
This is used in fields such as a picture or file viewer.
Syntax
[formname].fieldname.Data
DataSize
Retrieves the data size attribute of a file viewer field.
Syntax
[formname].fieldname.DataSize
DataType
Retrieves a constant integer value indicating the data type of the field.
This field attribute is read only at runtime.
Syntax
[formname].fieldname.DataType [constant]
These are the possible values for constant:
•	FCString - character or text data
•	FCInteger - long integer numeric data
•	FCLong - long integer numeric data
•	FCSingle - double floating point numeric data
•	FCDouble - double floating point numeric data
•	FCCurrency - currency data
•	FCDate - date and time data.
Editable
Retrieves or assigns the Editable attribute of a field. Setting the Editable field attribute allows the user to edit and modify a field's value.
Syntax
[formname].fieldname.Editable [= TRUE|FALSE value]
Extend
Displays field text in extended text style. 
Note
The extended text style is not available on the Windows client; it is only available on the Mac OS client.
Syntax
[formname].fieldname.Extend [=TRUE|FALSE value]
FileCreator
Retrieves the Mac OS file creator attribute of a file viewer field.
Syntax
[formname].fieldname.FileCreator
FileFlags
Retrieves the Mac OS file flags attribute of a file viewer field.
Syntax
[formname].fieldname.FileFlags
Filename
Retrieves the file name attribute of a file viewer field.
Syntax
[formname].fieldname.Filename
FileSize
Retrieves the file size attribute of a file viewer field.
Syntax
[formname].fieldname.FileSize
FileType
Retrieves the Mac OS file type attribute of a file viewer field.
Syntax
[formname].fieldname.FileType
FullJust
Retrieves or assigns whether or not the field is fully justified.
Syntax
[formname].fieldname.FullJust [=TRUE|FALSE]
Gray
Displays field text in gray rather than the default color (black). 
Use this attribute in conjunction with the Protected attribute to indicate editable fields that are currently protected.
Syntax
[formname].fieldname.Gray [=TRUE|FALSE value]
Hidden
Hides a field.
Note
When this attribute is set, all users are prevented from viewing and manipulating the field. Since the field is unavailable to the user, modifying data, receiving events, and processing event procedures are not possible from the user interface. Field attributes, values, and events may still be accessed from within the code.
Syntax
[formname].fieldname.Hidden [= TRUE|FALSE]
Icon
Retrieves or assigns the resource ID of the currently displayed icon.
The resource ID must match an icon resource ID that the users have in their settings file, the client itself, or the FirstClass Resource Registry. Otherwise, nothing will be displayed. 
Note
Icon changes do not require transfer of data from client to server, so any icon resource ID changes are very quick.
Syntax
[formname].fieldname.Icon [= resource]
Index
Retrieves or assigns the ordinal number of the currently selected field in a fixed list or expanding database list.
Syntax
[formname].fieldname.Index [= numericvalue]
The first element in a list is designated as Index 0. When the focus is set to an item in the list, the Index attribute of the list is set to the field's ordinal value. The Index may also be set by direct assignment to a positive integer value.
Italic
Displays field text in italics.
Syntax
[formname].fieldname.Italic [= TRUE|FALSE value]
Key
Retrieves or assigns a nondisplaying Key value in association with an element in an expanding database list or fixed list field.
Note
The Key attribute can be assigned a value of any type, but once assigned at runtime, the data type of the Key attribute for the list cannot be changed.
Syntax
[formname].fieldname.Key [=anyvalue]
List
Retrieves or assigns the List attribute of a list field.
Syntax
[formname].fieldname.List [=string expression]
The List attribute is stored as a semicolon-delimited list of strings. If the list is used in an enumerated list field, the values will be automatically assigned to each string in the list. Automatically generated numbers begin with 0 and increment one number for each item in the list. Numbers can also be assigned to the list items in an enumerated list.
Example
Cat;Dog;Fish will be displayed in a list field as three separate strings (one string per list): Cat, Dog, and Fish.
Automatically generated numbers:
Cat	'returns 0
Dog	'returns 1
Fish	'returns 2
Assigned numbers:
Cat=100;Dog=23;Fish=7	
Cat 'returns 100 
Dog 'returns 23 
Fish 'returns 7
ListCount
Returns the current number of items in an expanding or fixed list field.
Syntax
[formname].fieldname.ListCount
For more information, see fixed lists and expanding lists in FirstClass Rapid Application Developer Guide.
ModificationDate
Retrieves the modification date attribute of a file viewer field.
Syntax
[formname].fieldname.ModificationDate
Name
Retrieves or assigns the name of a field. 
Note
Changing the name of a field with the program running can cause unpredictable behavior unless code is carefully written.
Syntax
[formname].fieldname.Name[= fieldname]
where fieldname is the name of the field in string expression format.
NoOpenSpace
Prevents the form from expanding if the field expands.
Syntax
[formname].fieldname.NoOpenSpace [= TRUE|FALSE value]
Outline
Displays the field text in outline text style.
Note
The outline text style is not available on the Windows client, only on the Mac OS client.
Syntax
[formname].fieldname.Outline [=TRUE|FALSE value]
Password
Displays all text characters as asterisks. Text values will be exactly as they are input, but any input and output to this field will be displayed as asterisks.
Syntax
[formname].fieldname.Password [= TRUE|FALSE value]
Protected
Prevents all users from manipulating the field. This includes modifying data, receiving events, and processing event procedures. Field attribute values and events may still be accessed from within the code.
Syntax
[formname].fieldname.Protected [=TRUE|FALSE value]
ResourceSize
Retrieves the Mac OS resource fork size attribute of a file viewer field.
Syntax
[formname].fieldname.ResourceSize
RJust
Displays field text with right justification.
Syntax
[formname].fieldname.RJust [= TRUE|FALSE value]
Selectable
Makes a field able to be selected.
Syntax
[formname].fieldname.Selectable [=TRUE|FALSE value]
Selected
Sets the focus to the field. 
Note
This attribute has been deprecated; use the SetFocus field method.
Syntax
[formname].fieldname.Selected [=TRUE|FALSE value]
Shadow
Displays the field text in shadow text style. 
Note
The shadow text style is not available on the Windows client; it is only available on the Mac OS client.
Syntax
[formname].fieldname.Shadow [=TRUE|FALSE value]
Text
Retrieves or assigns the string that is the text value for the field. Text and Value are the default attributes for fields. This is only applicable to fields of string type, such as text fields and editable lists.
Syntax
[formname].fieldname.Text [=string expression]
Transparent
Displays fields with transparent backgrounds. Background fields, such as graphics and icons, are visible through this field.
Syntax
[formname].fieldname.Transparent [TRUE|FALSE]
Underline
Underlines field text.
Syntax
[formname].fieldname.Underline [=TRUE|FALSE value]
Value
Retrieves or assigns the numeric value of a field.
This is only applicable to fields with numeric values, such as checkboxes and enumerated lists.
Syntax
[formname].fieldname.Value [=TRUE|FALSE value]
The Value field attribute also retrieves date information. Text and the Value field attribute are the default attributes for fields.
Wrap
Displays field text with word wrap. This is essential for any multiline text box. 
To enter and display carriage returns in a text field, this attribute must be set.
Syntax
[formname].fieldname.Wrap [TRUE|FALSE value]
Language reference contents
Field events
Change
Calls an event when the value of a field changes.
Example
Sub Change()
...
End Sub
Click
Calls an event when the user clicks an unprotected field.
Example
Sub Click()
...
End Sub
DoubleClick
Calls an event when the user double-clicks an unprotected field.
GotFocus
Makes a field active (receives focus), which triggers an event.
A field can receive focus by being clicked, being selected with the Tab key, or programmatically with the SetFocus method.
LostFocus
Makes a field inactive (loses focus), which triggers an event.
A field loses focus when another field gains the focus.
Language reference contents
Field methods
AddItem
Adds an item to an existing list field.
Syntax
[formname].fieldname.AddItem(string)
You can use AddItem to simplify the use of dropdown lists by automating the addition of new items to the list. AddItem finds the item specified in the string parameter and adds to the list. AddItem can only be used on editable and static selection lists and affects the List attribute.
DblClick
Calls an event when the user double-clicks a field. 
You can associate code with the DblClick method whenever you wish it to be executed by double-clicking.
Example
Sub DblClick()
...
End Sub
RemoveItem
Removes an item from an existing list field.
Syntax
[formname].fieldname.RemoveItem(string)
You can use RemoveItem to simplify the use of dropdown lists by automating the deletion of items from the list. RemoveItem finds the item specified in the string parameter and removes it from the list, leaving all other entries the same. RemoveItem can only be used on editable and static selection lists and affects the List attribute.
Example
RemoveItem (an item in the list)
SelLength
Sets the length of the selected text in a text field.
Syntax
[formname].fieldname.SelLength(numeric expression)
If a starting point for the selection of text is not set with SelStart, the selected text begins at the first character. If the numeric expression is larger than the number of characters in the text buffer, SelLength selects all of the text in the field. If numeric expression is set to 0, the cursor is placed at the location specified by SelStart (or character 0 if SelStart is not called first) and no text is selected.
Example
Sub Click()
	...
	StringField1002.SelLength(25)	'select the 1st 25 chars in StringField 1002
	StringField1002.SelLength(0)	'0 = no selection; place cursor at SelStart
	StringField1002.SelLength(5)	'select characters 7 - 12
	...
End Sub
SelStart
Sets the starting position in the code for a text selection.
Syntax
[formname].fieldname.SelStart(position)
where position is a numbered string expression.
Use SelStart to specify the character at which to begin a SelLength text selection. Use SelStart(0) to set the selection at the beginning of the text field.
Example
Sub Click()
	...
	StringField1002.SelStart(5)	'set the starting position for text selection
	StringField1002.SelStart(7)	'set the starting position for text selection
	...
End Sub
SetFocus
Sets the application focus of a field.
If the form the field is on is shown, but not active, the form is activated and the focus is set. If the field receiving focus is hidden or protected, this method has no effect.
Syntax
[formname].fieldname.SetFocus
Example
Sub Click()
	StringField1002.SetFocus	'set focus to StringField 1002
End Sub
Language reference contents
Field types
Buttons
Checkbox
Has a default Value attribute equal to 0 (off), 1 (on) or 2 (grayed).
Configure your checkbox in FirstClass Designer if you want more than two positions to be displayed.
Command
You can either set a command in FirstClass Designer to use the button in FirstClass RAD, or assign functionality to the Click method of the button.
The Text attribute allows you to control, programmatically, the text displayed on the button.
Radio
Use with actions such as click, to provide additional programmatic direction when the button is pressed by the user. Radio buttons do not have a Value attribute.
To find which radio button is selected, use the Value attribute of the radio group field which contains the radio button field. 
Remember to set each radio button field in any radio group to a different value in FirstClass Designer.
Radio group
Contains the RadioButton value which is currently selected from the available buttons in the group. The radio group field has a Value attribute that is the default.
The button values must be set in FirstClass Designer and must be unique in order to function properly.
URL
Preset in FirstClass Designer to open a single URL. An URL button cannot be modified programmatically in FirstClass RAD. 
Note
As a workaround, use a command button and the LaunchURL command in the Click method of the button to achieve the same thing.
Date
Has a Value attribute that contains the date entered or displayed in the field as a Date data type. This pertains to any field that contains a date.
Editable text
Has a Text attribute that contains the text entered into the field.
Editable selection list
Has a List attribute that contains the items displayed in the list exactly as they are assigned in FirstClass Designer. 
Items are semicolon delineated. An editable selection list has a Text attribute which contains the string of the selected item from the list. To get a numeric response instead of a string, use a static selection list. You can set editable selection lists to noneditable mode with the Editable attribute in FirstClass Designer or programmatically if you don't want the user to be able to enter values that are not in the list.
Expanding list
Has the same attributes as its subfield type as set in FirstClass Designer. If the subfield type is Text, you can use the Text attribute of any subfield. 
Expanding list attributes are accessed as an array. For example, lstExpanding(0)="Hello" would set the first attribute of the expanding list to a literal string. You can use the Reset method to clear all field content for the field, and the Index attribute to identify which element in the list has the focus.
File viewer
Contains arbitrary data including binary data. 
The file viewer field method displays the data if there is an available viewer, but can also be used to store undisplayable binary data as well. You can use file viewer fields to display picture data from a database, for example, or provide a method for users to upload data to the program. You can use special attributes, such as FileName, FileSize, FileType, FileCreator, and FileFlags to get information about the file currently held in the file viewer field.
Fixed list
Has the attributes of their subfield type as set in FirstClass Designer.
If the subfield type is text, you can use the text attribute of any subfield. 
Fixed list attributes are accessed as if the fixed list is an array, so lstFixed(0)="Hello" would set the first attribute of the fixed list to a literal string. You can use the Reset method to clear all field content for the field and the Index attribute to identify which element in the list has the focus. Fixed lists stay whatever size you initially set them, unlike expanding lists, which grow larger as more elements are added.
Graphics
Icon
Provides a Value attribute that contains the icon ID of the icon displayed in the field.
Line
Has no special attributes.
Oval
Has no special attributes.
Picture
Provides a Value attribute equal to the resource ID of the picture. 
The picture resource must exist in the settings file or the FirstClass Resource Registry in order to be properly displayed.
Rectangle
Has no special attributes.
Round rectangle
Has no special attributes.
Group box
Has no special attributes.
Guide text
Has a Text attribute that contains the text displayed in the field.
Marquee
Has a Text attribute that contains the text in the marquee.
Number
Has a Value attribute that contains the number entered in the field. 
This field type only allows numeric entry; no text is possible.
Progress bar
Has a Value attribute which can be set or retrieved and indicates the progress on the bar. 
The range of this value is set in FirstClass Designer and defaults to 0 to 100.
String with icon
Has both a Text attribute that contains the text portion of the field and an Icon attribute that contains the resource ID of the icon associated with the field.
Time period
Has a Value attribute that contains a numeric representation of the period of time displayed in the field.
Language reference contents
File attributes
Archive
Retrieves or assigns a file's Windows archive bit. This attribute is ignored for Mac OS file downloads.
Syntax
filevariable.Archive
CreationDate
Retrieves or assigns a file's creation date.
Assignment of the creation date is only applicable to file downloads.
Syntax
filevariable.CreationDate
Data
Retrieves or assigns a file's data.
The Data attribute contains binary data which, in most instances, may be manipulated as a string. The Data attribute is used directly in conjunction with the Download and Read methods.
Syntax
filevariable.Data
DataSize
Retrieves the file's data fork size in bytes.
Syntax
filevariable.DataSize
FileCreator
Retrieves or assigns a file's Mac OS file creator.
The FileCreator attribute is ignored for Windows file operators.
Syntax
filevariable.FileCreator [integer|string]
This attribute may be assigned either a long integer or a four-character string representing the Mac OS file creator (for example, MyFile.FileCreator = "ttxt").
FileFlags
Retrieves or assigns the file's Mac OS file flags.
The FileFlags attribute is ignored for Windows file operators.
Syntax
filevariable.FileFlags
Filename
Retrieves or assigns a file's filename.
Syntax
filevariable.Filename
FileSize
Retrieves a file's size in bytes.
The size of the resource fork, if any, is counted in returning the size of the file.
Syntax
filevariable.FileSize
FileType
Retrieves or assigns the file's Mac OS file type.
This attribute is ignored for Windows file operations.
Syntax
filevariable.FileType [= string]
This attribute may be assigned either a long integer or a four-character string representing the Mac OS file type (for example, MyFile.FileType = "TEXT").
Hidden
Retrieve or assigns a file's Windows hidden bit.
This attribute is ignored for Mac OS file downloads.
Syntax
filevariable.Hidden
ModificationDate
Retrieves or assigns a file's last modification date. Assignment of the modification date is only applicable to file downloads.
Syntax
filevariable.ModificationDate
Normal
Retrieves or assigns the normal file bit for a Windows file.
A file with this attribute does not have the read-only, system, hidden, or archive bits set.
Syntax
filevariable.Normal
ReadOnly
Retrieves or assigns the file's Windows read-only bit.
This attribute is ignored for Mac OS file downloads.
Syntax
filevariable.ReadOnly
ResourceSize
Retrieves the file's resource fork size in bytes.
Syntax
filevariable.ResourceSize
SubDir
Indicates whether the file entry is a subdirectory.  It is used for accessing directory information returned from the FindFirst and FindNext methods. This attribute is read only.
The TRUE/FALSE flag indicates whether the item is a subdirectory. TRUE if it is, FALSE if it is a file or other file system object.
Syntax
filevariable.SubDir
System
Retrieves or assigns the file's Windows system bit. The TRUE/FALSE flag indicates whether the file contains the operating system's system bit.
This attribute is ignored for Mac OS file downloads.
Syntax
filevariable.System
Language reference contents
File methods
CloseFile
Closes a file that has been opened with the OpenFile method.
Note
If a variable is declared globally, the file closes when the program ends. If a variable is declared locally, the file closes when the program exits that subroutine.
Syntax
filevariable.CloseFile
Example
See the example for the Openfile method.
Download
Initiates a client file download. 
To specify the default file name (displayed in the file download dialog) supply the file object's Filename attribute.
The downloaded object may be either a file in a file system or it may be created from a string or data variable. To download a file in a file system, open the desired file for reading with the OpenFile method and then call the Download method. To download a file from a string or data variable, assign the Data attribute of the file object that does not currently have a file open, and call the Download method.
Syntax
filevariable.Download
Example
MyFile.Data = "Test File Data"
MyFile.Filename = "Test.txt"
MyFile.Download
EOF
Returns the current status of the end of file (EOF) flag. The EOF flag indicates whether the file has read up to, or beyond, the end of the file.
Syntax
filevariable.EOF
Example
See the example for the Read file method.
FindFirst, FindNext
Retrieves file information from the server's file system.
Syntax
Filevariable.FindFirst(filespec), filevariable.FindNext
The FindFirst method retrieves information from the first file found matching the filespec argument (any string representing a valid operating system file specification including wildcards). The FindNext method finds the next file (and subsequent files) matching the filespec argument specified in FindFirst.
When there are no more matching files, the filevariable's FileName attribute will be an empty string ('''').
Do not open the filevariable with the OpenFile method when using FindFirst, FindNext.
Example
MyFile.FindFirst ("C:\Winnt\*.exe)
MyFile.FindNext
OpenFile
Opens, creates, or sends a file for reading, writing, and/or downloading.
Syntax
filevariable.OpenFile(path,openconst)
The path specifies a path to a file on the server that is to be opened. The openconst argument specifies how the file should be opened and can consist of the following values:
•	fc.Read - opens a file for reading; otherwise displays an error
•	fc.Write - opens a file for writing; otherwise displays an error
•	fcAppend - opens a file for appending without removing the EOF marker before writing new data.
A new file is created if one does not exist.
•	fcUpdate - opens a file for both reading and writing; otherwise displays an error
•	fcReadWrite - opens an empty file for both reading and writing.
If the file exists, the contents are deleted. Otherwise, the file is created.
Example
MyFile.OpenFile ("C:\TEST.TXT", fcWrite)
MyFile.OpenFile ("C:\TEST.TXT", fcRead)
Position
Moves the file cursor used for reading and writing.
Syntax
filevariable.Position(origin[,offset])
The Position method moves the position of the cursor in a file in the server's file system. The origin argument indicates the starting point, and the offset argument indicates the number of bytes to move from that location (+ value indicates a move forward; - value indicates a move backwards). The origin argument must be one of the following:
•	fcBegin - file cursor origin at the beginning of file
•	fcEnd - file cursor origin at the end of file
•	fcCurr - file cursor origin at the current position (unchanged).
Example
MyFile.Position (fcBegin) 'position cursor at beginning of file'
MyFile.Position (fcEnd, -10) 'position cursor 10 characters back from end of file'
Read
Attempts a binary read of bytes from a file on the server.
Syntax
filevariable.Read(numbytes)
The read data is stored in the Data attribute of the File object. If the end of file is reached before numbytes bytes are read, the Read method stores the maximum number of bytes.
Example
MyFile.Read(100)
Print MyFile.Data
ReadLine
Reads from an open text file until the end of the current line and returns the result as a string. This makes text parsing much easier and allows for faster reading of text-based data into RAD variables.
Syntax
ReadLine (MaximumBytesToBeRead)
Example
Dim MyFile as File
	MyFile.OpenFile ("c:\autoexec.bat", fcRead)
		print "The first line of your autoexec.bat file is:" & 
	MyFile.ReadLine(1024)
	MyFile.CloseFile
Write
Writes binary or text data to a file on the server.
If the file has not been opened for writing with the OpenFile method, Write will display an error.
Syntax
filevariable.Write(filedata)
Example
MyFile.Write  'This string is written into the file
Language reference contents
Internal functions
Abs
Computes the absolute value of a numeric expression.
Syntax
Abs(numeric expression)
Abs returns the unsigned magnitude of any numeric expression. For example, Abs(-21) returns 21 and Abs(21) returns 21. The return value from the Abs function will be of the same type as that of the argument.
Example
Sub Main()
	Print "Absolute value of .3456 is:",
Abs(.3456)
	Print "Absolute value of -.3456 is:",
Abs(.3456)
End Sub 
Asc
Returns the ANSI numeric value for the first character in a string expression.
Syntax
Asc(string expression)
The string expression argument can be any valid string; however, only the first character in the string expression will be evaluated. Any subsequent characters will be ignored.
Example
See the code example for the Chr internal function.
Atn
Computes the arctangent of a number.
The return value of Atn is expressed in radians. The return type for Atn is Double.
Syntax
Atn(numeric expression)
Chr
Returns a string containing the character represented by the ANSI numeric code argument.
Syntax
Chr(numeric expression)
Example
Sub Main()
	Dim i as Integer
	Dim c as String
	For i = 1 to 255
	c = Chr(i)
		Print "character:", c
End Sub
Cos
Computes the cosine of a number. 
The return value of Cos is expressed in radians. The return type for Cos is Double.
Syntax
Cos(numeric expression)
DateSerial
Returns a date value given the year, month, and day as arguments.
If an invalid date has been specified, the system will display an error.
Syntax
DateSerial(year, month, day)
The arguments for this function accept any numeric expression which evaluates to the following integer values:
•	year - 100 to 9999 inclusive
•	month - 1 to 12 inclusive
•	day - 1 to 31 inclusive.
Example
Sub Main ()
	Dim myyear As Integer
	Dim mymonth As Integer
	Dim myday As Integer
	Dim mybirthday As Date
	myyear = 1971 : mymonth = 7 : myday = 9
	mybirthday = DateSerial(myyear, mymonth, myday)
		Print "My birthday is:", mybirthday
End Sub
DateValue
Returns a date value given a string argument.
Syntax
DateValue(string expression)
The argument for this function is any string expression that represents a valid date. If an invalid string has been specified, the system will display an error.
Example
Sub Main()
	Dim mydatestr As String
	Dim mybirthday As Date
	mydatestr = "7/9/71"
	mybirthday = DateValue (mydatestr)
		Print "My birthday is:", mybirthday
End Sub
Day
Returns the day of the month (1-31) for any valid date expression.
Syntax
Day(date expression)
Example
Sub Main()
	Dim d As Date
	Dim daynum As Integer
	d = Today
	daynum = Day(d)
	Select Case daynum
		Case 1, 21, 31
			Print "Today is the "; daynum; "st of the month"
		Case 2, 22
			Print "Today is the "; daynum; "nd of the month"
		Case 3, 23
			Print "Today is the "; daynum; "rd of the month"
		Case Else
	End Select
End Sub
Exp
Returns the natural logarithm base number e raised to the power of a numeric argument.
The return value is a floating-point number.
Syntax
Exp(numeric expression)
The argument for this function can be any valid numeric expression.
Fix
Removes the fractional part of a number and return the truncated value as an integer (or a long).
This is identical to the Int function.
Syntax
Fix(numeric expression)
The argument may be any valid numeric expression.
Example
Sub Main()
	Dim mynum As Double
	mynum = 3.1415
		Print "The whole number part of 'mynum' is:"; Fix (mynum)
		Print "...and the decimal part of the number is:"; mynum - Fix(mynum)
End Sub
Hex
Returns the string containing the hexadecimal value of a number.
Syntax
Hex(numeric expression)
The numeric expression argument is rounded to an integer value before being evaluated.
Example
Sub Main()
	Dim i As Integer
	Dim hexval As String
	For i = 0 to 256
		hexval = Hex(i)
			Print "decimal:", i
			Print "hex:", hexval
	Next i
End Sub
Hour
Returns an integer (0-23) that represents the hour from any valid date expression.
Syntax
Hour(date expression)
Example
Sub Main()
	...
	Dim secnum As Integer, minnum As Integer, 
	hournum As Integer
	...
	secnum = Second(d)
		Print "The current second is "; secnum
End Sub
IIf (immediate if)
Evaluates the expression and returns one of two possible values.
IIf can only be used to return either of two values rather than directing programmatic flow. The return type of IIf is the same as that of the value that is returned.
Syntax
IIf(conditional expression, trueval, falseval)
The trueval and falseval arguments can be of any type. These arguments do not need to be the same data type.
Example
Sub Main()
	Dim i As Integer
	For i = 1 to 10
		Print "the value of i is";
IIf(i<=5, "less than or equals", "greater than"); "5"
	Next i
End Sub
InStr
Returns the position of the first occurrence of one string (searchstring) within another (sourcestring).
Syntax
InStr([start,]) sourcestring, searchstring [case])
The optional start argument is a valid numeric expression used to offset the starting position of the search in sourcestring. If the start argument is omitted, the default starting offset is 1. The optional case argument is used to determine the case sensitivity of the comparison.

If case is 0, the comparison is case sensitive, for example, "a"<>"A". If case is 1, the comparison is case insensitive, for example, "a"="A". If the case argument is omitted, the default behavior is case sensitive comparisons. If the case argument is used, the start argument is required.

If searchstring is found within the sourcestring, this function returns an integer that indicates the character position of the first occurrence of the string. If searchstring was not found, InStr returns 0. If searchstring is a zero-length string, start is returned.
Example
Sub Main()
	Dim s As String, Ioc As Integer
	s = "the quick brown fox jumps over the lazy dog"
	Ioc = InStr(s, "fox")
	If Ioc<>0 Then
		Print "The string 'fox' was first found at character position "; Ioc 
	Else
		Print "The string 'fox' was not found in the search string"
	End If
End Sub
Int
Removes the fractional part of a number and returns the truncated value as an integer (or a long).
Syntax
Int(numeric expression)
The argument can be any valid numeric expression.
Example
Sub Main()
	Dim mynum As Double
	mynum = 3.1415
		Print "The whole number part of 'mynum' is:"; Int(mynum)
		Print "...and the decimal part of the number is:"; mynum - Int(mynum)
End Sub
IsArray
Determines whether the supplied argument is an array. It returns TRUE or FALSE depending on whether the supplied argument is an array.
Syntax
IsArray(variablename)
Example
Sub Main()
	Dim i As Integer
	Dim arr(10) As Integer
	If IsArray(arr) Then
		For i = LBound(arr) To UBound(arr)
			arr(i) = i
		Next i
	End If
End Sub
IsDate
Determines whether the supplied argument is a valid date. It returns TRUE or FALSE depending on whether the supplied argument is a valid date.
Syntax
IsDate (date expression)
The date expression argument may be a string, date, or any numeric data type.
Example
Sub Main()
	Dim d As Date
	Dim s As String
	s = "1/2/97"
	If IsDate(s) Then
		d=s
		Print "Valid date format"
	Else
		Print "Invalid date format"
	End If
End Sub
IsNumeric
Determines whether the supplied argument is numeric. It returns TRUE or FALSE depending on whether the supplied argument is a valid numeric expression.
Syntax
IsNumeric(expression)
LaunchURL
Launches a URL (http, ftp, fcp, mailto...) on the FirstClass client.
Syntax
LaunchURL(URL string)
Supply the desired URL as a string to the command and it will be launched in the registered browser, mail client, or other applicable application.
Example
Sub Main()
	LaunchURL ("http://www.centrinity.com")
End Sub
LBound
Returns an integer indicating the lower bound of an array.
If the variable is not an array, an error occurs.
Syntax
LBound(array variable)
Example
Sub Main()
	Dim i As Integer
	Dim arr(10) As Integer
	If IsArray(arr) Then
		For i = LBound(arr) To UBound(arr)
			arr(i) = i
		Next i
	End If
End Sub
LCase
Returns a string argument converted to all lowercase letters.
Syntax
LCase(string expression)
Example
Sub Main()
	Dim s As String
	s = LCase ("hEllo wOrld")
	Print s
'displays "hello world"
	Print LCase("THIS IS NOW LOWERCASE")
'displays "this is now lowercase"
End Sub
Left
Returns a string containing the leftmost characters of a string argument.
Syntax
Left(string expression, numeric expression)
The numeric expression argument can be any valid integer value greater than or equal to 0. If numeric expression is greater than or equal to the length of string expression, the entire string is returned.
Example
Sub Main()
	Dim s As String, Ioc As Integer
	s = "the quick fox jumps over the dog"
	Ioc = InStr(s, " ") 		'find the first occurrence of a space character
	If Ioc<>0 Then
		Print "The first word in the sentence is:"; Left(s, Ioc - 1)
		Print "The rest of the sentence is:"; Right(s, Len(s) - Ioc)
	Else
		print "Invalid sentence (no spaces)."
	End If
End Sub
Len
Returns the length of a string argument (as an integer), or the number of bytes required to create a variable.
Syntax
Len (string expression|variable name)
The argument string expression can be any valid string expression.
Example
Sub Main()
	Dim s As String, length As Integer
	Dim x As Long, y As Double
	s = "the quick brown fox jumps over the lazy dog"
	length = Len(s)
	...
		Print "The size of Double is"; Len(y); "bytes"
End Sub
Log
Computes the natural logarithm of a number.
Syntax
Log(numeric expression)
LTrim
Returns a string with all leading space and tab characters removed.
Syntax
LTrim(string expression)
The argument string expression can be any valid string.
Example
Sub Main()
	Dim s As String
	s = "		test string	"
		Print "(" & LTrim(s) &  ")"	
	'prints (test string		)
End Sub
Mid
Returns a substring from within a string expression.
Syntax
Mid(string expression, start offset [,length])
The string expression argument can be any valid string. The start  offset argument specifies the character offset from which to retrieve the substring. The optional length argument indicates the number of characters to return. If the length argument is omitted, Mid returns all characters from the start offset to the end of the string. If length is longer than the remaining number of characters in the string, all characters from the start and offset to the end of the string are returned.
Example
Sub Main()
	Dim s As String
	Dim loc As Integer, loc2 As Integer
	s = "the quick fox runs fast"
	loc = InStr(1, s, " ")
	loc2 = InStr(loc + 1, s, " ")
		Print "token:"; Mid(s, loc + 1, loc2 - loc - 1);" ' "
End Sub 
Minute
Returns an integer (0-59) that represents the minute from any valid date expression.
Syntax
Minute(date expression)
Example
See the code example for the Second Internal Function.
Month
Returns the month of the year for any valid date expression.
Syntax
Month(date expression)
Example
Sub Main()
	Dim d As Date
	Dim monthnum As Integer
	d = Today
	monthnum = Month(d)
		Select Case monthnum
			Case 1
				Print "This is the "; monthnum; " month of the year"
			...
			Case Else
				Print "This is the   "; monthnum; " month of the year"
		End Select
End Sub
MsgBoxResponse
Returns the value of the last user input to the MsgBox BASIC command.
MsgBoxResponse returns one of these constant values:
•	fcOK - user clicked the OK button
•	fcCancel - user clicked the Cancel button
•	fcYes - user clicked the Yes button
•	fcNo - user clicked the No button.
Syntax
MsgBoxResponse
Example
See the code example for the Sgn internal function.
Now
Returns a date value containing the current time and date from the server's system clock.
Syntax
Now
Example
Sub Main()
	Dim d As date
	d = Now
	Print "The current time and date is: ", d
End Sub
Oct
Returns a string containing the octal value of a number.
Syntax
Oct(numeric expression)
The numeric expression argument is rounded to an integer value before being evaluated.
Example
See the code example for the Hex internal function.
Replace
Searches the source string for all occurrences of the search string. Each time the search string is found, it is replaced with the defined replacement string.
Syntax
Replace(sourcestring, searchstring, replacestring)
The sourcestring, searchstring, and replacestring arguments can be any valid string expressions.
Example
Sub Main()
	Dim s As string
	s = "one, two, three, four, five"
	s = Replace(s, ",", ";")
	' s is now assigned "one; two; three; four; five"
	Print s
End Sub
Right
Returns a string containing the right-most characters of a string argument.
Syntax
Right(string expression, numeric expression)
numeric expression can be any valid integer value greater than or equal to 0. If numeric expression is greater than or equal to the length of the string expression, the entire string is returned.
Example
See the code example for the Left internal function.
Rnd
Returns a random fractional number from 0 to 1.
Note
To seed the Rnd function with new values, use the Randomize BASIC command.
Syntax
Rnd
Example
See the code example for the Randomize command.
Round
Removes the fractional part of a number and returns the rounded value as an integer (or a long). Numbers with fractional parts greater than or equal to 0.5 will be rounded up to the nearest integer value. Numbers with fractional parts less than 0.5 will be rounded down.
Syntax
Round(numeric expression)
The argument can be any valid numeric expression.
Example
Sub Main()
	Dim mynum As Double
	Dim i as integer
	For I = 1 to 20
		mynum = i/10
			Print "The value of 'mynum' is: "; mynum
			Print "The rounded value of 'mynum' is: ";
Round(mynum) 
	Next i
End Sub	
RTrim
Returns a string with all trailing space and tab characters removed.
Syntax
RTrim(string expression)
The argument string expression can be any valid string.
Example
Sub Main()
	Dim s As String
	s = "                  test string
		Print "(" & RTrim(s) & ")"
		'prints (           test string)
End Sub	
Second
Returns an integer value that represents the seconds from any valid date expression.
Syntax
Second(date expression)
Example
Sub Main()
	Dim d As Date
	Dim secnum As Integer, minnum As Integer, hournum As Integer
	d = Time
	hournum = Hour (d)
	minnum = Minute (d)
	secnum = Second (d)
		Print "The current hour is  "; hournum
		Print "The current minute is  "; minnum
		Print "The current second is  "; secnum
End Sub	
Sgn
Returns an integer value indicating the sign of a number.
Syntax
Sgn(numeric expression)
The numeric expression argument can be any valid numeric expression. If the value of a numeric expression is less than 0, Sgn returns -1. If the value of a numeric expression is greater than 0, Sgn returns 1. If the value of a numeric expression is 0, Sgn returns 0.
Example
Sub Main()
	Dim dbl As Double
	Dim mysign As Integer
	dbl = 3.1415
	mysign = Sgn (dbl)
	If mysign < 0 Then
		Print "The value of 'dbl' is negative"
	Else
		If mysign > 0
			Print "The value of 'dbl' is positive"
		Else
			Print "The value of 'dbl' is zero"
		End If
	End If 
End Sub	
Shell
Runs an executable program on the server.
Programs run on the server may have command line arguments passed to them, however, no additional input may be provided to the running program. Operating system shell commands may also be run from this function. Shell returns an integer value that is the command interpreter's error code. 0 indicates that the command interpreter was able to begin processing the request. Non-zero indicates an error.
Syntax
Shell(string expression)
The argument must be the full path and executable name of the program to be run on the server.
Example
Sub Main()
	Dim rc As Integer
	rc = Shell ("Copy C:\FCPO\LogFiles\*.* C:\Backup\LogFiles")
	If rc = 0 Then
		Print "Copy has started successfully."
	Else
		Print "Could not begin copy."
	End If
End Sub	
Sin
Computes the sine of a number.
The return value of Sin is expressed in radians. The return type for Sin is Double.
Syntax
Sin(numeric expression)
Space
Returns a string containing a number of space characters indicated by the argument.
Syntax
Space(numeric expression)
The argument can be any valid numeric expression.
Example
Sub Main()
	Dim MyStringVariable As String
	MyStringVariable = Space(15) ' returns a string with 15 spaces
	'to the variable MyStringVariable
		Print MyStringVariable
Spawn
Runs a process or application on the FirstClass server.
This function has several advantages over the Shell() function and, where possible, should be used in place of that function.
Syntax
Spawn(application name [fcWait | fcNoWait])
application name contains a text string which is the application name to be executed, including any command line arguments. 
The second argument is a constant, which specifies whether the application should wait until the called process has completed (fcWait: synchronous; can block the FirstClass server) or whether the application should launch the process and continue executing (fcNoWait: asynchronous; never blocks the FirstClass server).
Example
Spawn ("C:\Acrobat3\Reader\AcroRd32.exe", fcNoWait) 'launches a program on the server and immediately resumes processing the application'
End Sub
Sqr 
Returns the square root of any valid numeric expression (as a floating-point number).
Syntax
Sqr(numeric expression)
Example
Sub Main()
	Print "The square root of 2 is:", Sqr(2)
End Sub
StartupString
Returns the startup string (command line argument) for an application.
This is used to differentiate different installations of an application or to seed a FirstClass RAD program with initial values.
Syntax
StartupString
Example
Sub Main()
	Print "The command line argument for this application is"; 
	StartupString
End Sub
Str
Returns a string representation of a number (for any valid numeric expression).
Syntax
Str(numeric expression)
Example
Sub Main()
	Dim cost As String
	Dim output As String
	cost = Str(5000)
	output = "the total cost is: " & cost
		Print output
End Sub
StrComp
Compares two string expressions.
Syntax
StrComp(string1, string2,[, case])
The optional case argument is used to determine the case sensitivity of the comparison. If case is 0, the comparison is case sensitive ("a" <> "A"). If case is 1, the comparison is case insensitive ("a" = "A"). If the case argument is omitted, the default behavior is case-sensitive comparisons ("a" <> "A"). StrComp returns the following integer values based on the comparison evaluation:
•	-1 string1 < string2
•	0 string1 = string2
•	1 string1 > string2
•	undefined	NULL string.
Example
Sub Main()
	Dim s As String
	s = "aaa"
	Select Case StrComp(s, "bbb")
	Case -1
		Print "Source string is less than comparison string."
	...
	End Select
End Sub
StrFill
Creates a string of repeating characters of a specified length.
Syntax
StrFill(numeric expression, character expression)
The numeric expression argument specifies the number of characters in the result string. The character expression argument can be either a string representation or the ANSI code of a character. If the character is passed as a string representation, only the first character of the string is used.
Example
Sub Main()
	Dim MyStringVariable As String
	MyStringVariable = StrFill(5, "@") ' returns "@@@@@
	Print MyStringVariable
	...
End Sub
StrToken
Parses a delimited string into its component substring tokens. This enhances FirstClass RAD's ability to quickly and easily parse delimited strings. 
Syntax
StrToken(sourcestring, delimiters, tokennumber)
StrToken takes 3 arguments:
•	sourcestring -  contains a delimited list of substring tokens 
•	delimiters - a text string which specifies all of the delimiters to use when separating tokens
•	tokennumber - the ordinal number of the substring to return (starting with 1 for the first string).
Example
This example gets the last login time of the administrator and breaks the resulting batch administration reply up into its constituent substrings. This code uses both the space character and the double-quote character (Chr(34)) as delimiters for the delimiters argument. Batch administration replies without quotes will not need the Chr(34) as delimiters for the delimiter argument. Batch administration replies without quotes will not need the Chr(34) delimiter and can simply use the space or other delimiter as needed.
Sub Main()
	BatchAdmin ("Get User Admin 123 +d")
	Print "source string:"; fcBatchAdminReply
	Print "substring 1:"; StrToken (fcBatchAdminReply, " " & Chr(34), 1)
	Print "substring 2:" ; StrToken(fcBatchAdminReply, " " & Chr(34), 2)
	Print "substring 2:" ; StrToken(fcBatchAdminReply, " " & Chr(34), 3)
	Print "substring 2:" ; StrToken(fcBatchAdminReply, " " & Chr(34), 4)
End Sub
Running this code gives you the following output (dates and times will vary on your system):
	source string: 1230 14 "2000/01/04  13:30:39"
	substring 1: 1230
	substring 2: 14
	substring 3: 2000/01/04
	substring 4: 13:30:39
Tab
Returns a string containing the Tab character.
Syntax
Tab
Example
Sub Main()
	Dim s As String
	s = "apple" & Tab & "orange" & Tab & "grape"
	Print s 'creates a tab-delimited list of strings and displays them to output window
End Sub
Tan
Computes the tangent of a number. 
The return value of Tan is expressed in radians. The return type for Tan is Double.
Syntax
Tan(numeric expression)
TCase
Returns a string argument converted to title case.
Syntax
TCase(string expression)
Example
Sub Main()
	Dim s As String
	s = TCase("jon q. public")
	Print s 			'displays "jon q. public"
End Sub
Time
Returns the current time from the server's system clock.
Syntax
Time
Example
See the code example for the Second internal function.
Timer
Returns the number of seconds that have elapsed since 12:00 AM. This is useful for benchmarking application operations.
Syntax
Timer
Example
Sub Main()
	Dim timestart As Integer, timefinish As Integer
	timestart = Timer
	MsgBox("How fast can you click OK?")
	timefinish = Timer
		Print "It took you "; timefinish - timestart; "seconds to click OK"
End Sub
TimeSerial
Returns a date data type value given the hour, minute, and second as arguments.
If an invalid time has been specified, the system will display an error.
Syntax
TimeSerial(hour, minute, second)
The arguments for this function accept any numeric expression that evaluates to the following integer values:
•	hour - 0 to 23 inclusive
•	minute - 0 to 59 inclusive
•	second - 0 to 59 inclusive.
Example
Sub Main()
	Dim meethour As Integer
	Dim meetmin As Integer
	Dim meetsec As Integer
	Dim mymeeting As Date
	meethour = 14: meetmin = 15: meetsec = 0
	mymeeting = TimeSerial(meethour, meetmin, meetsec)
	Print "I have a meeting at:", mymeeting
End Sub
TimeValue
Returns a date data type, given a string argument.
Syntax
TimeValue(string expression)
The argument for this function is any string expression that represents a valid time. If an invalid time string has been specified, the system will display an error.
Example
Sub Main()
	Dim mytimestr As String
	Dim mymeeting As Date
	mytimestr = "2:15:00 PM"
	mymeeting = TimeValue(mytimestr)
	Print "I have a meeting at: ",mymeeting
End Sub
Today
Returns the current date from the server's system clock.
Syntax
Today
Example
See the code example for the Day internal function.
Trim
Returns a string with all leading and trailing space and tab characters removed.
Syntax
Trim(string expression)
The argument string expression can be any valid string.
Example
Sub Main()
	Dim s As String
	s="	test string	"
	Print "(" & Trim(s) & ")"
	'prints (test string)
End Sub
UBound
Returns an integer indicating the upper bound of an array.
If the variable is not an array, an error occurs.
Syntax
UBound(array variable)
Example
See the code example for the IsArray internal function.
UCase
Returns the string argument converted to all uppercase letters.
Syntax
UCase(string expression)
Example
Sub Main()
	Dim s As String
	s = UCase(hELlo wOrld")
		Print s	'displays "HELLO WORLD"
		Print UCase ("this is now uppercase")
'displays "THIS IS NOW UPPERCASE"
End Sub
Val
Returns the numeric value of a string argument.
Syntax
Val(string expression)
The string expression argument can be any string that represents a number. If string expression contains the decimal point character, Val returns a floating-point value, otherwise Val returns an integer value.
Example
Sub Main()
'this program converts string "50" into a number and then uses the number in a math calculation
	Dim s As String
	Dim num As Integer
	s = "50"
	num = Val(s)
		Print "The numeric value of 's' times 5 is: ",num *5
End Sub
Weekday
Returns a number indicating the day of the week for any valid date expression.
Syntax
Weekday(date expression)
Example
Sub Main()
	Dim d As Date
	Dim daynum As Integer
	Dim mydays(1 to 7) As String
	mydays(1) = "Sunday": mydays(2) = "Monday":...
	d = today
	daynum = Weekday(d)
		Print "Today, the day of the week is"; mydays(daynum)
End Sub
Year
Returns the year from any valid date expression.
Syntax
Year (date expression)
Example
Sub Main()
	Dim d As Date
	Dim yearnum As Integer
	d = Today
	yearnum = Year(d)
		Print "This year is"; yearnum; "A.D."
End Sub
Language reference contents
FirstClass internal functions
BatchAdmin
Runs administration-level batch administration commands.
The return string will contain either the requested data or information describing any errors that might have occurred. A return code is generated and may be retrieved with the FCBatchAdminCode internal function. A return string of text is generated and may be retrieved with the FCBatchAdminReply internal function.
Syntax
BatchAdmin (batchcommand)
BatchAdmin takes the batchcommand argument and passes it to batch administration with administrator-level permissions.
Example
BatchAdmin ("getadmin")
if FCBatchAdminCode <> 0 Then
	Print "Error with batch script!!!"
	Print "The error message is:"; FCBatchAdminReply
Else
	Print "The Admin's account is:"; FCBatchAdminReply 'gets the admin user ID and prints it to the debug window
End If
FCAppBuildNumber
Returns the current .fcx build number (as an integer value) of an application. 
Build numbers are built into .fcx-compiled applications when they are entered on the Project Attributes form. This form is accessed by clicking Options on the Project tab in FirstClass RAD project manager.
Syntax
FCAppBuildNumber[(applicationname)]
If the optional argument applicationname is supplied, this function returns the build number of the specified application provided that it is loaded on the server. If the optional argument is not supplied, FCAppBuildNumber returns the build number of the calling application.
FCAppDescription
Returns the application description information (as a string) of an application.
Application description information strings are built into .fcx-compiled applications when they are entered in the FirstClass RAD Project Attributes form.
Syntax
FCAppDescription[(applicationname)]
If the optional argument applicationname is supplied, this function returns the application description information of the specified application provided that it is loaded on the server. If the optional argument is not supplied, FCAppDescription returns the application description information of the calling application. 
FCAppDeveloper
Returns the developer information (as a string) of an application.
Application developer information strings are built into .fcx-compiled applications when they are entered in the FirstClass RAD Project Attributes form.
Syntax
FCAppDeveloper[(applicationname)]
If the optional argument applicationname is supplied, this function returns the developer information string of the specified application provided that it is loaded on the server. If the optional argument is not supplied, FCAppDeveloper returns the developer information string of the calling application. 
FCAppIcon
Returns an application's icon resource number as a numeric value that is compiled into the application by FirstClass RAD.
Syntax
FCApplcon[(applicationname)]
If the optional application argument applicationname is omitted, the value returned is from the called application.
FCAppLoadState
Returns the current load status of the application specified by the optional applicationname argument.
If no argument is specified, FCAppLoadState returns the load status of the calling application. 
This function returns one of the following constants:
•	FCAppLoaded - application is currently loaded by FirstClass RAD
•	FCAppUnloaded - application is not loaded by FirstClass RAD
•	FCAppUnloading - FirstClass RAD is unloading the application
•	FCAppReloading - FirstClass RAD is reloading the application.
Syntax
FCApploadState[(applicationname)]
FCAppLaunchMethod 
Returns the method by which the calling application was launched.
This function returns one of the following constants:
•	FCServerLaunched - application is launched as server application
•	FCSessionLaunched - application is launched at client login
•	FCDebugLaunched - application is launched by FirstClass RAD in debug mode
•	FCUserLaunched - application is launched from Desktop stationery
•	FCAppLaunched - application is launched from another FirstClass RAD application.
Syntax
FCAppLaunchMethod
FCAppName
Returns the name (a string value) of the calling application.
Syntax
FCAppName
FCAppServerVersion
Returns the version number of FirstClass RAD currently running.
The version number is returned as a whole number integer representing the version number multiplied by 1000. For example, RAD version 1.210 will return the value 1210, version 2.0 will return 2000, and so on.
This internal function is useful for determining backward compatibility issues between applications and FirstClass RAD.
Syntax
FCAppServerVersion
Example
FCAppServerVersion = 1210
FCAppSessionUsage
Returns the number of application sessions currently in use on the FirstClass server.
Syntax
FCAppSessionUsage[(applicationname)]
If the optional argument applicationname is supplied, this function returns the number of application sessions currently in use by the specified application.
FCAppVersion
Returns the version number (as a string) of an application.
Application version strings are built into .fcx-compiled applications when they are entered in the FirstClass RAD Project Attributes form.
Syntax
FCAppVersion[(applicationname)]
If the optional argument applicationname is supplied, this function returns the version number string of the specified application provided that it is loaded on the FirstClass server. If the optional argument is not supplied, FCAppVersion returns the version string of the calling application. 
FCBatchAdmin
Sends a batch administration command to the FirstClass server and returns a result code.
The function returns the success or failure of the call as a numeric value. A non-zero result indicates an error has occurred; zero indicates success. Any data returned from the batch administration request (including explicit error messages) may be accessed via the FCBatchAdminReply function.
Syntax
FCBatchAdmin(batchstring)
where batchstring is a single string argument that the FCBatchAdmin FirstClass internal function sends to FirstClass batch administration for processing.
FCBatchAdminCode
Returns the last batch administration command's return code.
If FCBatchAdminCode returns a non-zero value, there has been an error with the last batch administration command executed. 
Syntax
FCBatchAdminCode
FCBatchAdminReply
Retrieves a string containing batch administration reply data supplied from the last FCBatchAdmin call.
Syntax
FCBatchAdminReply
Example
Sub Main()
	If FCBatchAdmin ("GET ADMIN") = 0 Then
		Print "The Default Admin account is: ";
FCBatchAdminReply
	End If
End Sub
FCClientPlatform
Returns a constant value that is the platform on which the FirstClass client is currently being used.
FCClientPlatform returns one of the following values:
•	fcCLUI - command line user interface
•	fcDOS - DOS client
•	fcFinger - Finger
•	fcFTP - FTP
•	fcGateway - gateway
•	fcHTTP - HTTP
•	fcIMAP - IMAP
•	fcInternet - Internet Services
•	fcJava - Java client
•	fcLDAP - LDAP client
•	fcMac OS - Mac OS client
•	fcMAPI - MAPI
•	fcNNTP - NNTP
•	fcOfflineServer - offline server
•	fcPersonalServer -FirstClass Personal server
•	fcPOP - POP
•	fcSMTP - SMTP
•	fcUNIX - UNIX client
•	fcUnknown - unknown client platform	
•	fcVoice - Voice
•	fcWindows - Windows client.
Syntax
FCClientPlatform
FCClientVersion
Returns an integer value that is the FirstClass client's version number.
Syntax
FCClientVersion
FCEventShiftState
Returns the current state of the Shift and Ctrl keys when an event occurs.
FCEventShiftState returns the following integer values based on the shift state:
•	no special state - 0
•	Shift key held - 1
•	Ctrl key held - 2
•	Shift and Ctrl keys held - 3.
Syntax
FCEventShiftState
FCGetPrivGroup
Retrieves the FirstClass server's privilege group list into the FCGetPrivGroup array.
FCGetPrivGroup returns an integer indicating the total number of privilege groups in the current FirstClass server. Upon calling the FCGetPrivGroup, an application may call the FCPrivGroup function to retrieve the names of the server's privilege groups.
Syntax
FCGetPrivGroup
Example
Sub Main()
	Dim i As Integer
	Dim NumGroups As Integer
	NumGroup = FCGetPrivGroup
	End If
End Sub
FCPOFolder
Returns the path (as a string) to the FirstClass server's main post office folder, regardless of platform.  
Syntax
FCPOFolder
Example
print FCPOFolder
FCPrivGroup
Returns a string value which is the name of a privilege group.
Syntax
FCPrivGroup(groupnum)
The groupnum argument specifies the ordinal number, starting at 0 or the current array base index, of the privilege group in the group list. The internal function FCGetPrivGroup must be called to initiate the privilege group list.
Example
Sub Main()
	Dim i As Integer
	Dim NumGroups As Integer
	NumGroup = FCGetPrivGroup
	For i = 0 to NumGroups -1
		Print FCPrivGroup(i)
	End If
End Sub
FCSpawnReturn
Obtains the return code from a process started by Spawn or Shell.
Syntax
FCSpawnReturn
FCSeverSerialNumber
Returns an integer value that is the FirstClass server's serial number.
This function is often used for application licensing purposes.
Syntax
FCServerSerialNumber
FCUserFirstName
Returns a string containing the first name of the user currently using the application.
Syntax
FCUserFirstName
Example
Sub Main()
	Print "Your Account Information"
	Print "...................................."
	Print "First Name:"; FCUserFirstName
	...
End Sub
FCUserID
Returns a string containing the user ID of the FirstClass user currently using the application.
Syntax
FCUserID
Example
Sub Main()
	Print "UserID:"; FCUserID
	...
End Sub
FCUserLastName
Returns a string containing the last name of the FirstClass user currently using the application.
Syntax
FCUserLastName
Example
Sub Main()
	Print "Last Name:"; FCUserLastName
	...
End Sub
FCUserMI
Returns a string containing the middle initial of the FirstClass user currently using the application.
Syntax
FCUserMI
Example
Sub Main()
	Print "Middle Initial:"; FCUserMI
	...
End Sub
FCUserName
Returns a string containing the full user name of the FirstClass user currently using the application.
Syntax
FCUserName
Example
Sub Main()
	Print "Full Name:"; FCUserName
	...
End Sub
FCUserPrivGroup
Determines whether the user is in the specified privilege group.
If the user is not in the privilege group, or the privilege group specified does not exist, the function returns FALSE. If the user is in the privilege group specified, the function returns TRUE.
Syntax
FCUserPrivGroup(privilege group)
Example
Sub Main()
	If FCUserPrivGroup("Administrators") Then
		Print "You are a member of the 'Administrators' privilege group."
	Else
		Print "You are not a member of the 'Administrators' privilege group."
		Print "Access Denied"
		End		'terminate the program
	End If
End Sub
Language reference contents
Statement attributes
AsyncEnable
Retrieves or assigns an integer value indicating the ODBC asynchronicity of a statement.
Syntax
statementname.AsyncEnable [ = constant]
These are the possible values for constant:
•	SQL_ASYNC_ENABLE_OFF - off
•	SQL_ASYNC_ENABLE_ON - on
•	SQL_ASYNC_ENABLE_DEFAULT - off.
The default value for this attribute is SQL_ASYNC_ENABLE_OFF, which indicates that the statement will process synchronously.
BindType
Retrieves or assigns an integer value indicating the ODBC column binding of a statement.
Syntax
statementname.BindType [ = constant]
These are the possible values for constant:
•	SQL_BIND_BY_COLUMN - column binding
•	SQL_BIND_TYPE_DEFAULT - row-wise binding.
The default value for this attribute is SQL_BIND_TYPE_DEFAULT.
Column
Retrieves or assigns column attributes and methods.
Syntax
statementname.Column(colname | colnum)[.attribute] [ = value]
This attribute references a cursor's column either by name or by ordinal number. 
Concurrency
Retrieves or assigns an integer value indicating the ODBC concurrency of a statement.
Syntax
statementname.Concurrency [ = constant]
These are the possible values for constant:
•	SQL_CONCUR_READ_ONLY - updates will be attempted; cursor is read only
•	SQL_CONCUR_LOCK - cursor uses the lowest level of locking sufficient to ensure that the row can be updated
•	SQL_CONCUR_ROWVER - cursor uses optimistic concurrency control, comparing row versions
•	SQL_CONCUR_VALUES - cursor uses optimistic concurrency control, comparing values.
The default value for SQL_CONCURRENCY is SQL_CONCUR_READ_ONLY.
CursorType
Retrieves or assigns an integer value indicating the ODBC cursor type of a statement.
Syntax
statementname.CursorType [ = constant]
These are the possible values for constant:
•	SQL_CURSOR_KEYSET_DRIVEN
•	SQL_CURSOR_FORWARD_ONLY
•	SQL_CURSOR_DYNAMIC
•	SQL_CURSOR_STATIC
•	SQL_CURSOR_TYPE_DEFAULT
•	SQL_CURSOR_FORWARD_ONLY - the cursor only scrolls forward
•	SQL_CURSOR_STATIC - the data in the result set is static
•	SQL_CURSOR_KEYSET_DRIVEN - the driver uses the keys for the number of rows specified in the SQL_KEYSET_SIZE statement option
•	SQL_CURSOR_DYNAMIC - the driver only uses the keys for the rows in the rowset.
The default value is SQL_CURSOR_FORWARD_ONLY. This attribute cannot be set on an open cursor.
DisplayErrors
Specifies whether the default error handling system should be used or disabled in the event that an ODBC error occurs. 
If the DisplayErrors attribute is set to TRUE (the default), ODBC errors will be delivered via modal message box to the offending application. 
If the DisplayErrors attribute is set to FALSE, the error message will be suppressed and normal application processing will continue, ignoring the error. Specific error information may then be retrieved by the DBError and DBErrorCode attributes, allowing you to build custom database error handlers.
Syntax
statementname.DisplayErrors [= TRUE/FALSE]
Example
Sub Main ()
	Dim stmt as dbStatement
	stmt.OpenStatement(Parks, dbDynamic, dbRowver)
	stmt.DisplayErrors = FALSE
	stmt.ExecuteSQL("Select * from parkinfo")	
	...
End sub
DisplayWarnings
Indicates whether ODBC warning messages should be displayed when they occur on the statement.
Syntax
statementname.DisplayWarnings [ = TRUE|FALSE]
The default value is FALSE, indicating that warnings should be suppressed.
KeysetSize
Retrieves or assign an integer value indicating the number for rows in an ODBC keyset driven cursor.
Syntax
statementname.KeysetSize [= size]
The size variable can be set to the desired size or to the default SQL_KEYSET_SIZE_DEFAULT, which indicates that the keyset is completely keyset-driven.
MaxLength
Retrieves or assigns an integer value indicating the maximum amount of data that can be returned from a column.
Syntax
statementname.MaxLength [ = length]
The length variable can be set to the desired length or to the constant SQL_MAX_LENGTH_DEFAULT, which indicates that the column should return all data.
MaxRows
Retrieves or assigns an integer value indicating the ODBC maximum rows to return in a statement.
Syntax
statementname.MaxRows [ = numrows]
The numrows variable can be set to the desired number of rows or to the constant SQL_MAX_ROWS_DEFAULT, which returns all rows returned from the query.
NoScan
Retrieves or assigns an integer value indicating whether the ODBC driver should scan an SQL string for ODBC escape clauses.
Syntax
statementname.NoScan [ = constant]
These are the possible values for constant:
•	SQL_NOSCAN_OFF - off
•	SQL_NOSCAN_ON - on
•	SQL_NOSCAN_DEFAULT - on.
The default value for this attribute is SQL_NOSCAN_ON, which indicates that SQL strings will not be scanned for escape clauses.
NumCols
Retrieves the number of columns returned in a statement.
This attribute is read only at runtime.
Syntax
statementname.NumCols
QueryTimeout
Retrieves or assigns an integer value indicating the ODBC query timeout in seconds.
Syntax
statementname.QueryTimeout [= timeout]
The timeout variable can be set to the desired number of seconds or to the constant SQL_QUERY_TIMEOUT_DEFAULT, which indicates that the query will continue to execute until it has completed.
RetrieveData
Retrieves or assigns an integer value indicating whether the ODBC driver should automatically retrieve the data for the current row.
Syntax
statementname.Retrieve [= constant]
These are the possible values for constant:
•	SQL_RD_OFF - off
•	SQL_RD_ON - on
•	SQL_RD_DEFAULT - on.
The default value for this attribute is SQL_RD_ON, which indicates that data will be automatically retrieved for each row.
RowsetSize
Retrieves or assigns an integer value indicating the cursor rowset size.
Syntax
statementname.RowsetSize [ = size]
The size variable can be set to the desired number of rows in the rowset or SQL_ROWSET_SIZE_DEFAULT, which specifies a rowset size of 1 record.
SimulateCursor
Retrieves or assigns an integer value that specifies whether drivers that simulate positioned update and delete statements ensure that these statements affect only a single row.
Syntax
statementname.StatementCursor [ = constant]
These are the possible values for constant:
•	SQL_SC_NON_UNIQUE - does not guarantee that simulated positioned update or delete statements will affect only a single row
	The application must enforce this behavior.
•	SQL_SC_TRY_UNIQUE - attempts to guarantee that simulated positioned update or delete statements affect only a single row
	The driver always executes such statements, even if they might affect more than one row.
•	SQL_SC_UNIQUE - the driver guarantees that simulated positioned update or delete statements affect only a single row.
UseBookmarks
Retrieves or assigns an integer value indicating whether the statement can use bookmarks.
Note
To use bookmarks with a cursor, the application must specify this option before opening the cursor.
Syntax
statementname.UseBookmarks [ = constant]
These are the possible values for constant:
•	SQL_UB_OFF - off
•	SQL_UB_ON - on
•	SQL_UB_DEFAULT - off.
The default value for this attribute is SQL_UB_OFF.
Language reference contents
Statement methods
BOF
Returns the current value of the beginning of file (BOF) flag.
When the program attempts to move the record pointer off the beginning of the result set, the BOF flag is set to TRUE and the record pointer is positioned at the first record in the result set. 
Note
It is not possible to move completely off the front of the result set; the rowset buffers will always be associated with a row if there are rows in the result set.
BOF returns FALSE if the record pointer has been successfully moved to a new record in the result set. If the record set is empty, BOF and EOF always return TRUE.
Syntax
statementname.BOF
Compliance
Level 2
Example
The following example displays all contact names from a database from the last record to the first:
Sub DisplayContactNames(Contact as DBStatement)
	Contact.MoveLast
	Do While Not Contact.BOF
		Print "Contact name:"; 		Contact.Column("name")
	Contact.MovePrev
	Loop
End Sub
CloseStatement
Closes a statement on a database connection.
Changes made to row buffers that have not been updated are discarded.
Syntax
statementname.CloseStatement
Compliance
Core level
DBError
Returns a string containing the last database statement error.
This method is useful for determining the type of error that has occurred in an error handling routine.
Syntax
statementname.DBError
Compliance
Core level
DBErrorCode
Stores a numeric value which is the ODBC error code of the last operation performed. 
Constant values that are common return values from ODBC include:
•	db_success - operation completed successfully
•	db_success_with_info - operation completed successfully with more information available
•	db_no_data_found - no data was returned from the operation when data was expected
•	db_error - ODBC error occurred.
Syntax
statementname.DBErrorCode
Delete
Deletes the current record and moves the record pointer to the next record. The Delete method can be used on form fields.
There is no warning for deleting records with positioned deletes. Make sure your application deletes only the records you are interested in deleting. Delete confirmations are handled by the application.
Warning
Any records deleted with this method will be permanently lost.
Syntax
statementname.Delete
Compliance
Level 2
Example
The following example finds a specific record, prints out its information, and then deletes it from the database using a positioned delete.
Sub Main()
	Dim cnct As DBConnection
	Dim stmt As DBStatement
	cnct.OpenConnection("MyDSN")	'Open the data source "MyDSN"
	stmt.OpenStatement(cnct, dbKeyset, dbRowver)
	stmt.ExecuteSQL("SELECT * FROM MyTable WHERE CustNum = 12345")
	Print "Deleting Customer."
	Print "Customer Name:"; stmt.Column("CustName")
	Print "Customer Phone:"; stmt.Column("CustAddr")
	Print "Customer Last Contacted:";
stmt.Column("CustLastContact")
	stmt.Delete			'Delete the current record
	stmt.CloseStatement	
	cnct.CloseConnection	'Close the connection
End Sub
Empty
Returns whether or not the current recordset has any records.
If there are records in the recordset, Empty returns FALSE; otherwise, Empty returns TRUE.
Syntax
statementname.Empty
Compliance
Core level
Example
See the code example for the ExecuteSQL statement method.
EOF
Returns the current value of the end of file (EOF) flag.
When the program attempts to move the record pointer off the end of the result set, the EOF flag is set to TRUE and the record pointer is positioned at the last record in the result set. 
Note
It is not possible to move completely off the end of the result set; the rowset buffers will always be associated with a row if there are rows in the result set.
EOF returns FALSE if the record pointer has been successfully moved to a new record in the result set. If the record set is empty, BOF and EOF always return TRUE.
Syntax
statementname.EOF
Compliance
Core level
Example
The following example displays all contact names from a database from the first record to the last.
Sub DisplayContactNames(Contact as DBStatement)
	Contact.MoveFirst
	Do While Not Contact.EOF
		Print "Contact name:"; Contact.Column("name")
	Contact.MoveNext
	Loop
End Sub
ExecuteSQL
Executes an SQL statement and returns a cursor if applicable.
Syntax
statementname.ExecuteSQL(query)
Compliance
Core level
Example
The following example opens a connection on a data source, opens a statement on a connection, and runs a query to determine if a particular record exists. If the record exists, customer information is displayed. Otherwise, a warning is displayed.
Sub Main()
	Dim cnct As DBConnection
	Dim stmt As DBStatement
	cnct.OpenConnection("MyDSN")	'Open the data source "MyDSN"
	stmt.OpenStatement(cnct, dbKeyset, dbRowver)
	stmt.ExecuteSQL("SELECT * FROM MyTable WHERE CustNum = 12345")
	If (stmt.Empty) Then	'If no records were returned
		Print "The customer does not exist in the database!"
	Else
		Print "Customer Information:"
		Print "Customer Name:"; stmt.Column("CustName")
		Print "Customer Phone:"; stmt.Column("CustAddr")
		Print "Customer Last Contacted:";
stmt.Column("CustLastContact")
	End If
	stmt.CloseStatement
	cnct.CloseConnection	'Close the connection
End Sub
Filter
Requeries a record set with an SQL WHERE clause.
The Filter method is a fast, effective way of narrowing the records contained in a record set. Filter can be used on any statement cursor generated with an SQL statement provided that it does not have an SQL WHERE clause.
Filter is the preferred method for searching records in bound table applications.
Syntax
statementname.Filter(WHEREclause)
The Filter command appends the WHERE clause specified by the WHEREclause argument to the original SQL statement and requeries the database. After filtering a query, the record pointer points to the first record in the recordset.
Calling the Filter method with a WHEREclause of "" removes the current Filter WHERE clause and returns the complete unfiltered recordset.
Compliance
Core level
Example
The following code example filters the Customers table in the data environment by customer name with a text string read off the form.
Sub Click()
	Dim filterstr As String
	filterstr = "MyCustName Like "' & txtSearchText.Text & "%"'
	Customers.Filter(filterstr)
End Sub
FindFirst, FindLast, FindNext, FindPrev
Finds a record in a recordset.
Syntax
statementname.FindFirst(condition), statementname.FindLast(condition), statementname.FindNext(condition), statementname.FindPrev(condition)
This method moves the record pointer through the record set until condition evaluates to TRUE or the end of the record set is reached. Each time the record pointer is moved, condition is re-evaluated. 
The starting location and direction of record pointer movement depends on which method is used:
•	FindFirst - begins at the first record and moves forward through the record set
•	FindLast - begins at the last record and moves backward through the record set
•	FindNext - begins at the current record and moves forward through the record set
•	FindPrev - begins at the first record and moves backward through the record set.

If the condition does not evaluate to TRUE and the end of the record set is reached, the NoMatch flag is set to TRUE.
The argument condition may be any valid conditional expression; however, it is best to include comparisons to columns in the cursor or it is not likely that condition will evaluate to TRUE.
Note
In order to prevent deadlock in asynchronous systems, Find requires server re-entrance for each move and evaluation of condition. Re-entrance has a substantial amount of overhead and it is often faster and more effective to use the Filter method instead of a Find method.
Compliance
Level 2
Example
Sub Main()
	Dim cnct As DBConnection
	Dim stmt As DBStatement
	cnct.OpenConnection("MyDSN")	'Open the data source "MyDSN"
	stmt.OpenStatement(cnct, dbKeyset, dbRowver)
	stmt.ExecuteSQL ("SELECT * FROM MyTable")
	'Starting from the first record in the recordset, find the first record which 	
	'makes the condition CustNum = 12345 evaluate to TRUE.
	stmt.FindFirst(stmt.Column("CustNum") = 12345)
	If (stmt.NoMatch) Then	'Record was not found
		Print "The customer does not exist in the database!"
	Else
		Print "Customer Information:"
		Print "Customer Name: ";stmt.Column("CustName")
		Print "Customer Phone: ";stmt.Column("CustAddr")
		Print "Customer Last Contacted: ";stmt.Column("CustLastContact")
	End If
	stmt.CloseStatement
	cnct.CloseConnection	'Close the connection
End Sub
GetTables
Retrieves table information about the current data source and returns it as a result set.
Syntax
statementname.GetTables
Compliance
Level 1
Insert
Clears the current row buffers and prepares for positioned insert at the end of a record set. The record is not actually written to the database until the Update method is run.
Syntax
statementname.Insert
Compliance
Level 2
Example
The following example uses a positioned insert to insert a record into a record set. Once the statement is in insert mode, the row buffers are assigned values and then updated to write the new record to the database:
Sub Main()
	Dim cnct As DBConnection
	Dim stmt As DBStatement
	cnct.OpenConnection("MyDSN")	'Open the data source "MyDSN"
	stmt.OpenStatement(cnct, dbKeyset, dbRowver)
	stmt.ExecuteSQL("SELECT * FROM My Table")
	stmt.Insert				'Insert a new record
	stmt.Column("CustName") = "Harold"
	stmt.Column("CustAddr") = "99 Main Street"
	stmt.Column("CustLastContact") = Today
	stmt.Update				'Write new record to database
	stmt.CloseStatement
	cnct.CloseConnection		'Close the connection
End Sub
Lock
Locks the current record to prevent updates by other users.
The Lock method provides a way for applications to control concurrency on connections that do not support transactions. Generally, data sources that support concurrency levels and transactions will not support the Lock method.
To simulate a transaction, an application uses the Lock method to lock each of the rows in the transaction. It then uses the Update or Delete methods to update or delete each row. When all operations in the transaction have completed, the application uses the Unlock method to unlock each row.
A row locked with the Lock method remains locked until the application calls the Unlock method or until the statement is closed. 
Syntax	
statementname.Lock
Compliance
Some level 2 drivers
Example	
The following example locks the current record, updates it and then unlocks it so that it is available for other users to modify.
Sub Main()
	Dim cnct As DBConnection
	Dim stmt As DBStatement
	cnct.OpenConnection("MyDSN")	'Open the data source "MyDSN"
	stmt.OpenStatement(cnct, dbKeyset, dbRowver)
	stmt.ExecuteSQL("SELECT * FROM My Table WHERE CustNum = 12345")
	stmt.Lock
	stmt.Column("CustName") = "Harold"
	stmt.Column("CustAddr") = "99 Main Street"
	stmt.Column("CustLastContact") = Today
	stmt.Update		'Write new data to database
	stmt.Unlock
	stmt.CloseStatement
	cnct.CloseConnection	'Close the connection
End Sub
MakeList
Creates a list suitable for use as a static or editable List attribute from a column in a database.
The MakeList statement method generates a list of all the items contained in the statement by concatenating the results and separating the list with semicolons.
Syntax
MakeList(StringColumn, [NumericColumn])
The StringColumn is the text name of the column of data to be used to generate the list content. The NumericColumn is an optional argument used to add numeric values to the items in the list.
Example
...
Dim stmt As DBStatement
stmt.OpenStatement (MyConnection)
stmt.ExecuteSQL ("SELECT NAME ID FROM NAMES WHERE ID < 40")
1stNames.List=stmt.MakeList ("NAME", "ID")
stmt.CloseStatement
...
MoveFirst, MoveLast, MoveNext, MovePrev
Moves the position of the record pointer and updates bound columns.
The Move method automatically discards any changes on a modified or inserted record if the changes have not been written to the database with the Update method.
Syntax
statementname.MoveFirst, statementname.MoveLast,
statementname.MoveNext, statementname.MovePrev
The starting location and direction of record pointer movement depends on which method is used:
•	MoveFirst - moves the record pointer to the first record in the record set
•	MoveLast - moves the record pointer to the last record in the record set
•	MoveNext - moves the record pointer to the next record in the record set
•	MovePrev - moves the record pointer to the previous record in the record set.
Compliance
Level 2 (SQLExtendedFetch)
Example
The following example displays all contact names from a database from the first record to the last.
Sub DisplayContactNames(Contact as DBStatement)
	Contact.MoveFirst
	Do While Not Contact.EOF
		Print "Contact name:"; Contact.Column("name")
		Contact.MoveNext
	Loop
End Sub
NoMatch
Returns TRUE or FALSE depending on whether the last Find method located a matching record.
Syntax
statementname.NoMatch
Compliance
Level 2
Example
See the code example for the Find statement method.
OpenStatement
Opens a statement on a database connection.
Syntax
statementname.OpenStatement(cnctname [,dbCursorType] [dbConcurrency])
The cnctname argument specifies the name of a valid DBConnection object that has already opened a connection on a valid data source. 
The optional arguments dbCursorType and dbConcurrency may be used to set the statement's cursor type and concurrency respectively.
The dbCursorType argument may be set to one of the following constants:
•	dbForwardOnly - forward-only cursor
•	dbStatic - static cursor
•	dbKeyset - keyset-driven cursor
•	dbDynamic - dynamic cursor.

The dbConcurrency argument may be set to one of the following constants:
•	dbReadOnly - cursor is read only
•	dbLock - cursor uses row-level locking concurrency
•	dbValues - cursor uses optimistic concurrency, comparing values
•	dbRowver - cursor uses optimistic concurrency, comparing row versions.
The cursor type and concurrency may also be set explicitly with the Cursor Type and Concurrency attributes; however, the dbCursorType and dbConcurrency arguments provide an effective shortcut. 
If a statement's cursor type and concurrency are not explicitly specified, a statement creates by default a forward-only read-only cursor.
Compliance
Core level
Example
The following example opens a connection on a data source, opens a statement on a connection, and runs a query to determine if a particular record exists. If the record exists, customer information is displayed. Otherwise, a warning is displayed.
Sub Main()
	Dim cnct As DBConnection
	Dim stmt As DBStatement
	cnct.OpenConnection("MyDSN")	'Open the data source "MyDSN"
	stmt.OpenStatement(cnct, dbKeyset, dbRowver)
	stmt.ExecuteSQL("SELECT * FROM MyTable WHERE CustNum = 12345")
	If (stmt.Empty) Then	'If no records were returned
		Print "The customer does not exist in the database!"
	Else
		Print "Customer Information:"
		Print "Customer Name:"; stmt.Column("CustName")
		Print "Customer Phone:"; stmt.Column("CustAddr")
		Print "Customer Last Contacted:";
stmt.Column("CustLastContact")
	End If
	stmt.CloseStatement
	cnct.CloseConnection	'Close the connection
End Sub
Refresh
Refreshes the values in the current rowset buffers.
If changes have occurred to the current row in the underlying database, calling the Refresh method will update the local cursor and propagate any relevant changes to bound controls. 
If you have modified the current values in the rowset buffers, calling Refresh will get a new copy of the original row from the database and overwrite any changes.
Syntax
statementname.Refresh
Compliance
Level 2
Example
Sub Click()
	MsgBox("Update the current record?",FCYesNo, "Update")
	If MsgBoxResponse = FCYes Then 
		MyStmt.Update	'Update the current record
	Else
		MyStmt.Refresh	'Discard changes and retrieve original values
	End If
End Sub
Requery
Re-executes the current statement's query. This is similar to the Refresh method except that all rows in the cursor are refreshed. Upon calling the Requery method, the record pointer is positioned at the first record in the result set.
Syntax
statementname.Requery
Compliance
Core level
Unfilter
Requeries the record set without the WHERE clause specified by the Filter method.
Calling the Unfilter method is equivalent to calling the Filter method with a WHERE clause of "". Unfilter removes the current Filter WHERE clause and returns the complete unfiltered record set.
Syntax
statementname.Unfilter
Compliance
Core level
Unlock
Unlocks the current record to allow updates by other users.
Syntax
statementname.Unlock
Compliance
Some level 2 drivers
Example
See the code example for the Lock statement method.
Update
Updates the current row in the database. If possible, all changes to the row will be written to the database. The update method is also used to confirm the insertion of a new record.
Syntax
statementname.Update
Compliance
Level 2
Example
The following example runs SQL to retrieve a record, changes some column values, and writes the changes to the database using the positioned Update method.
Sub Main()
	Dim cnct As DBConnection
	Dim stmt As DBStatement
	cnct.OpenConnection("MyDSN")	'Open the data source "MyDSN"
	stmt.OpenStatement(cnct, dbKeyset, dbRowver)
	stmt.ExecuteSQL("SELECT * FROM MyTable WHERE CustNum = 12345")
	stmt.Column("CustName") = "Joe"
	smt.Column("CustAddr") = "101010 Binary Ave."
	stmt.Column("CustLastContact") = Today
	stmt.Update			'Write changes to the database
	stmt.CloseStatement	
	cnct.CloseConnection	'Close the connection
End Sub
Language reference contents
Top