Advertising banner:
 
 
 A311
 
81203_43854_21.png 81203_43840_19.png

BatchAdmin (Command, OptionalBufferSize)
Command
The single-line batch admin command to be sent.
OptionalBufferSize
An integer value for the number of bytes of buffer to reserve for the answer, for example 4096 would be 4k.  The limit to this buffer is the available memory on the server machine.


Command
Definition
Syntax
Example
Beep
Plays the FirstClass client's system beep sound.
81203_42521_14.png        Note
The FirstClass client cannot play the system beep unless the application has displayed a form.
Beep
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.
Call subroutine
Call subroutine(arg1, arg2...)
subroutine
You can add arguments (arg1, and so on) to this command.
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.
Console [printexpression,printexpression]
Console [printexpression,printexpression]
For an explanation of this syntax, see the Print command.
Console "Welcome to my application"
Console "Hello"; FCUserName
Console "the value of 'i' is";i
Const
Declares a user-defined constant.
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.
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.
CopyFile(FromPath, ToPath, TRUE/FALSE)
The third parameter determines whether or not the copy will overwrite an existing file.
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.
Debug StringToSend
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.
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.
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.
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.
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.
DoEvents (starttime, endtime)
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.
End
End Sub
End Function
End If
End Select
End Type
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.
Erase array
Erase array1, array2...
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.

Exit
Exit Sub
Exit Function
Exit Loop
Exit For
See code example for the For...Next BASIC command.
For...Next
Executes a group of commands for each increment of a counter.
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.
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.
Function FunctionName(ParameterToFunction As DataType) as DataType
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).
GiveTime
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.
81203_42521_14.png        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).
Gosub label
...
Return
The label must be the first nonblank characters on the line followed by a colon (:).
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).
Goto label
The label must be the first nonblank characters on the line followed by a colon (:).
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.
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.
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 and assigns values to variables (optional in the BASIC language).
Let VariableName = Value
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.
Load formname
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.
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.
MsgBox ("Would you like to save changes?", FCYesNoCancel, "Save")
On Error
Enables or disables error handling.
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.
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.
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.
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.
PlaySound(ResourceID)
Print
Displays output (printexpressions) to the FirstClass client's output window.
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.
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.
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.
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.
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.
ReDim Preserve MyArray (MAXVAL+1) As Integer
Rem
Comments out a line of text. The entire line is ignored.
Rem comment
'comment
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.
Report
Report printexpression
Report printexpression, printexpression
Report printexpression; printexpression
Report,
Report;
For an explanation of this syntax, see the Print command.
Report "Application began at:"; Now

RowCount
This is a statement attribute which returns the number of rows available in a statement.  
81203_40013_5.png        Warning
This is not supported by all ODBC drivers and is not a requirement of the ODBC specification.
RunApp
Runs a built and loaded application in a new application environment space.
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.
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.
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.
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.
Print "This program will self destruct in five seconds!"
Sleep (5)
End
Sort
Sorts a one dimensional array into ascending or descending order.
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.
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.
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.
Type typename
        varname As datatype
        [varname As datatype...]
End Type
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.
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.
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.
While condition
        commands
Wend


hirosue Shino Web Site