Purchase your Section 508 Compliance Support guide now!

Purchase your Section 508 Compliance Support guide now!

Triggering a Cognos 8 BI event externally

Triggering a Cognos 8 BI event externally

Republished from IBM Cognos Proven Practices

The Cognos 8 BI scheduler allows report execution and other events to run on a regular basis, for example every hour, day, week. However, instead of an event being executed to a schedule, it may be assigned to a trigger.  A triggered event is a task within Cognos 8 that is executed by an external process. Any content that can be scheduled can be executed by a trigger instead, for example a single report or a job.

Before creating an event that can be triggered, trigger support must be enabled. See the Disable Support for Trigger-based Scheduling section in the Administration and Security Guide for a step-by-step guide on how to enable / disable trigger support.

In order to allow a Cognos 8 event to be executed by an external process it must be scheduled as it would be if the internal Scheduler was being used.  However instead of setting a frequency of execution, you designate a trigger name. 

Setting a trigger in IBM Cognos 8 BI

Trigger.bat

Once a trigger has been created with Cognos 8 it can be executed from an external process.  Environments that have the Cognos 8 BI Software Development Kit (SDK) installed are able to execute the trigger from a custom application using the documented APIs.  For environments without the SDK, a convenient execution method is included with the standard Cognos 8 BI distribution.  A utility called trigger.bat is installed under <cognos8>\webapps\utilities\trigger.  This is a shell script which calls a Java program that in turn executes a Cognos 8 trigger.  In a UNIX environment, you can use trigger.sh.

The syntax for using trigger.bat is:

trigger.bat <gateway_URL> <username> <password> <SecurityNamespaceID> <triggername>

Being able to execute a trigger this way provides a lot of flexibility as the .bat or .sh script can be incorporated into a larger task such as the last step of an ETL task that performs a database update.

The provided trigger method does not have the capability to check that the tasks in the given trigger complete successfully – it simply initiates it.  For more sophisticated status checks, a custom SDK application would need to be written.

Running trigger.bat remotely

In many cases it is more desirable to run the trigger.bat file from a server that has no Cognos 8 BI components.  For example, a server may be dedicated to performing ETL jobs and needs to be able to trigger a Cognos 8 event.
 
In order to do this a Java runtime environment must be installed on the server where trigger.bat is to be executed from and you must copy the following .JAR files from the <cognos8>\webapps\p2pd\WEB-INF\lib directory -

  • axis.jar
  • jaxrpc.jar
  • axisCrnpClient.jar
  • saaj.jar
  • commons-discovery.jar
  • xml-apis.jar
  • commons-logging.jar
  • xercesImpl.jar

Additionally Trigger.class needs to be copied from the <cognos8>\webapps\utilities directory.
 
It is possible to also copy the trigger.bat file across, but it is recommended that the version below be used and the appropriate environment variables be modified accordingly (shown in red). This version of trigger.bat assumes that trigger.class and the .jar files have all been placed in the same directory.

Trigger Dot Bat