|Bookshelf Home | Contents | Index | PDF|
A call to a subprogram stands alone as a separate statement (read Call Statement). Recursion is supported.
The data type of a argument can be specified by using a type character or by using the As clause. Record arguments are declared by using an As clause and a type that has previously been defined using the Type statement. Array arguments are indicated by using empty parentheses after the argument. The array dimensions are not specified in the Sub statement. Every reference to an array within the body of the subprogram must have a consistent number of dimensions.
If an argument is declared as optional, its value can be omitted when the function is called. Only variant arguments can be declared as optional, and optional arguments must appear after the required arguments in the Sub statement. To check whether an optional argument was omitted by the user, use the IsMissing function (read IsMissing Function). For more information on using named arguments, read Named Arguments and Call Statement.
Use Function rather than Sub (read Function...End Function Statement) to define a procedure that has a return value.
CAUTION: You cannot write your own functions or subprograms directly in the methods and events exposed in Siebel Tools. You can write functions and subprograms in the (general) (declarations) section of a given method script. However, if you want your routines to be available throughout the program, you can use the Application_PreInvokeMethod or an external DLL file as a central place to write them. For details, read Siebel Technical Notes #207 and #217.
If you create more than one function or subprogram in the (general) (declarations) section, be sure that any function or subprogram that may be called by other user-defined functions and subprograms appears before the procedure that calls it. Otherwise, you can not compile your procedures.
|Siebel VB Language Reference|