Exploring TM1 - a Chartertech Company
Search
Close this search box.

How to Record TI Processing Notes in the Log using ItemReject in TM1

Sometimes we want to put some custom text directly into the TM1 Message log to record why something is occurring in a TM1 Turbo Integrator process. With ItemReject, you can place the current record into the TM1 message log alongside a custom message. You can therefore define a custom error to be recorded in your log that identifies a problem you caught in your TI.

ItemReject Syntax

The syntax is simply ItemReject(ErrorString); where ErrorString is the message you want to be put in the TM1 Message log alongside the record.

Simple Example and Usage

This example is simply checking if an element entered into a parameter exists in a dimension using a DIMIX and if it doesn’t, it puts a message in the log and quits the process.

IF ( DIMIX ( 'Location', pLocation) = 0);
  sErrorMessage = 'The Location entered does not exist';
  ItemReject ( sErrorMessage );
ENDIF;

More Complex Example and Usage of ItemReject

We use it to record an outcome in the message log. For example, we have a process that deletes all data from a target cube. There are parameters set up called pCube and pCheck – to capture the cube name to be cleared and to check if TM1 has been backed up before the clear process is run.

The code on Prolog is then:

## WARNING - THIS PROCESS COMPLETELY DELETES ALL DATA FROM THE TARGET CUBE ###
### Check if TM1 has backed up and that the cube to be completely cleared exists before continuing
IF (pCheck @= 'Y' % pCheck @='Yes');
  IF ( CubeExists ( pCube) = 0);
    sErrorMessage = 'The cube entered does not exist';
    ItemReject ( sErrorMessage );
  ELSE;
    CubeClearData ( pCube);
  ENDIF;
ELSE;
  sErrorMessage = 'User has indicated that the backup has not been completed';
  ItemReject ( sErrorMessage );
ENDIF;

This process will check if TM1 has been backed up, then check if the target cube exists, and then clear the data from it using CubeClearData. If either TM1 has not been backed up or the cube does not exist, it records in the Message Log the reason why the process has quit.

Notes

ItemReject is a TM1 TurboIntegrator function, valid only in TurboIntegrator processes.

  • This field is for validation purposes and should be left unchanged.

Post Sections

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *

Log In