Understanding the HCL Compass API

You can use this API to write code that runs within HCL Compass (hook code), or that runs independently of an instance of the HCL Compass application. You can also use the API to create an integration with a new or an existing application (service, tool, or utility) and the HCL Compass application.

Type of Code
Example
Hook scripts for your HCL Compass schema
Modify records that users submit, and validate the records before they are committed to the user database. (HCL Compass Designer provides an editor for you to insert hook scripts.)
External applications that run outside of HCL Compass
View or modify the data HCL Compass stores in the user database and schema repository.
Integrations with an application and HCL Compass
Integrate the functionality of a service, tool, or utility with the capability to view or modify the data HCL Compass stores in the user database and schema repository. See Considerations for HCL Compass integrations in the Schema Developer Help for more information.

HCL Compass runs your hooks in VBScript or Perl, but not both at the same time. HCL Compass Designer allows you to switch between scripting languages. For more information, see the Schema Developer Help.

You can write external applications in any programming environment that supports OLE automation (such as Visual Basic or Visual C++), or that can execute Perl scripts.

The HCL Compass enumerated constants are preloaded and available for use in field hooks and record and global scripts. However, to use the constants in an external application, you must add the constant definitions to your program before you can use them in the program, or the values will not be set.
  • For Perl, include the following statement:
    use CQPerlext;
  • For Visual Basic and VBScript, all of the HCL Compass enumerated constants are defined in compass.bas, located by default in the <install-directory>/Compass directory. For Visual Basic projects, you can add the compass.bas module to your project. You can also copy the constants from compass.bas into the same file as your code. For example, to use the AD_COMP_OP_EQ and AD_SUCCESS constants in a Visual Basic program, locate the following lines in compass.bas and copy them into your program file:
    Public Const AD_COMP_OP_EQ = 1
    Public Const AD_SUCCESS = 1