2About Siebel Visual Basic

About Siebel Visual Basic

This chapter describes Oracle’s Siebel Visual Basic. It includes the following topics:

Overview of Siebel Visual Basic

Siebel VB (Visual Basic) is a programming language that provides the following capabilities:

  • A fully functional procedural programming language

  • An application interface that provides bidirectional access to Siebel business objects

  • An editing environment that you can use to create and maintain custom Siebel VB code

  • A debugger that you can use to help detect errors in your Siebel VB code

  • A compiler that you can use to compile your custom Siebel VB code

  • A run-time engine that is similar to a Visual Basic interpreter that you can use to process custom Siebel VB code

You can use Siebel VB to create scripts that automate a variety of daily tasks.

Siebel VB does not support the following items:

  • Functionality developed through custom programming

  • Automatic upgrades of custom code with the Siebel Application Upgrader

  • Development of a separate, standalone application with Siebel VB

  • Accessing server management functionality. To configure this functionality, you must use the user interface of the server management software or the command line.

  • Development or deployment in a UNIX environment.

If you customize the Siebel Sales Enterprise application, then you must use caution. This customization must be done only by a trained technical professional.

Improper application configuration can adversely effect the reliability and performance of your Siebel application. You must thoroughly test any customization you develop before you implement your customization in a production environment.

    Siebel VB and Unicode

    Siebel VB supports Unicode except for functions that do the following:

    • Perform a file input operation or a file output operation

    • Accesses an external DLL that is dependent on character encoding and is not compliant with Unicode.

      Typographic Conventions That This Book Uses

      The following table describes the typographic conventions that this book uses.

      Item That This Book Represents Convention

      Statements and functions.

      Initial uppercase letters. For example:

      Abs Len(variable)

      Arguments for statements or functions.

      Letters that are in lowercase and that are italicized. A capital letter that occurs in a position other than the first letter can identify multiple English words. For example:

      • variable

      • rate

      • prompt

      • stringVar

      Optional arguments or characters.

      Square brackets. For example:

      • [caption]

      • [type]

      • [$]

      Required choice for an argument from a list of choices.

      A list in curly brackets. An OR operator ( | ) separates the possible choices. For example:

      {Goto label | Resume Next | Goto 0}

      For more information, see the following items:

      • Creating script that runs on UNIX and that uses a Siebel object manager, see Siebel Events Management Guide.

      • Creating, modifying, and deleting Siebel VB scripts that you use in Siebel Tools, see Siebel Object Interfaces Reference.

        About Functions and Methods

        A Siebel VB function is an independent section of code that does the following:

        1. Receives information

        2. Performs some action on this information

        3. Returns a value to the item that called it

        It begins with the following statement:

        Function functionname
        

        It ends with the following statement:

        End Function 
        

        You can use the same format that you use with a variable to name a custom function. You can use any valid variable name as a function name. It is recommended that you use a name that describes the work that the function performs.

        You can write code that calls a function repeatedly from various objects or script. It is similar to a subroutine. To call a function, you must know what information the function requires as input and what information it provides as output. This book describes the predefined functions that come with Siebel VB. You can use these functions any time you use the Siebel VB interpreter.

        You can use a function anywhere you can use a variable. To use a function, you do the following:

        • To declare it, you can use the function keyword.

        • To determine the data that Siebel VB must pass to the function, you include the function operator. To include this operator, you can use a pair of parentheses immediately after the function name. For example, TheApplication.RaiseErrorText().

        A Siebel VB method is a function that is part of an object or class. It can include a predefined procedure that you can use to call a function.

        A Siebel VB statement is a complete instruction.

        For more information, see Siebel eScript Language Reference.

        Siebel VB and Other Versions of Visual Basic Programming Languages

        This topic compares Siebel VB to other versions of the Visual Basic programming language.

          Differences Between Siebel VB and Earlier Versions of Visual Basic

          Siebel VB is similar to a high level language, such as the C programming language or Pascal. This topic describes some of the differences you might notice between older versions of Visual Basic and Siebel VB.

            Line Numbers and Labels

            Older versions of Visual Basic require numbers at the beginning of every line. More recent versions do not support or require line numbers. Use of line numbers causes error messages.

            You can use a label to reference a line of code. A label can be any combination of text and numbers. Typically it is a single word followed by a colon, and placed at the beginning of a line of code. The Go To statement uses these labels.

              Subroutines and Modularity

              Because Siebel VB is a modular language, it divides code into subroutines and functions. To perform actions, the subroutines and functions you write use Siebel VB statements and functions.

                How Declaring a Variable Affects Variable Scope

                The following table describes how you declare a variable affects variable scope.

                Scope Where the Variable Is Declared

                Local

                Declared in a subroutine or function. Only the subroutine or function that declares the variable can access this local variable.

                Module

                Declared in the general declarations section. Any subroutine, function, or event that is attached to the object in the script window that displays this variable can access this modular variable.

                Global

                Declared in one of the following items:

                • Application_Start event

                • Application.PreInvokeMethod method

                You can write code that accesses a global variable throughout the Siebel application. For more information, see Siebel Technical Note #217 on My Oracle Support.

                  Data Types

                  Siebel VB is a typed language. It includes multiple data types, such as strings, numbers, variants, and arrays.

                  A variable that you define as a variant can store any type of data. For example, the same variable can hold integers or strings, depending on the code.

                  Objects allow you to manipulate complex data that an application supplies, such as Microsoft Windows forms, or COM objects.

                  For more information, see About Data Types.

                    Financial Methods

                    Siebel VB includes financial methods that you can use to configure Siebel CRM to do a calculation. For example, to calculate a loan payment, an internal rate of return, or a future value according to a cash flow. For more information, see Financial Methods.

                      Date and Time Methods

                      Date and time methods can compare a file date to the current date, set the current date and time, time events, and do scheduling. For more information, see Date and Time Methods.

                        Methods to Access Other Applications

                        Microsoft Windows uses the Common Object Model (COM) standard to allow an application to access the functionality of another application. An object might be the end product of a software application. For example, a document from a word processing application. The Object data type allows Siebel VB to access another software application through these objects, and then modifies them. For more information, see COM Methods.

                          Environment Control

                          Siebel VB can call another software application and send keystrokes to the application. It can also run code and return values in the operating system environment table.

                            Differences Between Siebel VB and Visual Basic

                            Siebel VB, Microsoft Visual Basic, and Visual Basic for Applications (VBA) use functions and statements that are similar to one another, but each of these languages possess some unique capabilities.

                              Boolean Data Type

                              Siebel VB does not include a Boolean data type. It considers 0 to be FALSE and any other numeric value to be TRUE. You can write code that uses only a numeric value as a Boolean value. A comparison expression always returns 0 for FALSE and -1 (negative one) for TRUE. You can use the following values in an integer variable to simulate a Boolean data type:

                              • To represent TRUE. A value of 1 or any number that is not zero.

                              • To represent FALSE. A value of 0.

                              If you must call a field from a script, and if this field is a DTYPE_BOOL type field, then you must declare it as a string.

                                User Interface and Control Objects

                                Siebel VB does not include any Visual Basic user interface control objects, such as a Button Control. A Visual Basic property such as BorderStyle is not part of Siebel VB. Siebel VB allows you to reference user interface controls in Siebel CRM and set and get their values. you can use Siebel Tools to manage a Siebel CRM user interface. You must not use the Input statement in Visual Basic as a way to get keyboard input.