Bookshelf Home | Contents | Index | PDF | ![]() ![]() |
Siebel VB Language Reference > Methods Reference for Siebel VB > Code Setup and Control Methods > Create Function MethodThe Create Function method creates a function. It returns to the caller when it encounters an End Function statement or an Exit Function statement. It returns the value that the expression argument calculates. Format[Static] [Private] Function name([[Optional ]argument The following table describes the arguments that you can use with this method.
UsageFor information about the static and private keywords, see Usage for the Static Keyword and Private Keyword. A Visual Basic procedure passes values through reference. This means that if a procedure assigns a value to an argument, then it modifies the variable that the caller passes. You must use this feature with caution. For more information, see Pass Values Through Reference. For information about declaring optional arguments, see Declaring Optional Arguments. Specifying the TypeSpecifying the type character when you use the Create Function method is optional. A function can create and return a single value of a type that you specify. The data type of the value in the name argument determines the type of the return value. You can do one of the following to specify the data type: If you do not use one of these formats, then Siebel VB uses the default data type, which is variant. Specifying the Return ValueYou use the following format to specify the return value for the function name: If you do not include this code, then Siebel VB returns one of the following values:
You can use the Sub statement to define a procedure that does not include a return value. Caution About Writing a Custom Function or SubroutineIf you create more than one function or subroutine in the general declarations section, then you must make sure that any other custom function or subroutine that you create that calls this function or subroutine occurs before the procedure that calls it. Otherwise, you cannot compile your procedures. CAUTION: You cannot create a custom function or custom subroutine in a method or event that displays in Siebel Tools. You can create a custom function or custom subroutine in the general declarations section in the script of a method. If your function or subroutine must be available throughout the code, then you can use a PreInvokeMethod method or an external DLL file to store them in a central location. For more information, see doc ID 476501.1 on My Oracle Support. ExampleThe following example declares a function that the subroutine calls. The function performs a calculation on the value sent to it. This calculation modifies the value of the variable: (general) (declarations) Function Calculate(i As Single) Sub Button_Click For other examples, see Declare Procedure Method, and Example 2. Related TopicsCall Subroutine Method |
![]() ![]() |
Siebel VB Language Reference | Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Legal Notices. | |