The Example1.prj project will compile and run,
and present an empty dialog box.
This section describes
how to add code to this project to make a very simple IBM® Cognos® TM1® application.
Procedure
- Open the Example1.prj project from Windows Explorer.
- Open the project window, if it is not open already, by
choosing View, Project Explorer.
- In the project window, highlight Project1 (Example.vbp).
Right-click, and choose Add, Module.
- Click the Existing tab, and use
the file search dialog to find TM1API.BAS.
- Double-click the TM1API.BAS file to add it to your project.
- Choose View, Code from
the Microsoft Visual Basic
menus. A code window appears.
- Enter the following code in this window:
Option Explicit
This
line forces your variables to be strictly typed by MicrosoftVisual
Basic. It sometime help to make debugging easier.
- Click the option button containing the word (General).
Choose Form. The Form_Load subroutine opens.
- Enter the following code into the Form_Load subroutine:
Dim hUser As Long
TM1ApiInitialize()
hUser = TM1SystemOpen()
TM1SystemAdminHostSet hUser, "AdminHost"
This code
initializes the API, and calls TM1SystemAdminHostSet. Both of these
functions must be called in the order shown in any TM1 API program.
Note: The server
name established in the second argument to TM1SystemAdminHostSet will
have to be a TM1 Admin Host
in your network. The name AdminHost is only an example.
If
your program now compiles and run successfully, your project is properly
configured. You are ready to write a program that logs into a TM1 server. The following section
describes that code.