Error trapping example

Bedrock processes have their own auditing yet you may want to trap errors externally. Below is an example of using a BedrockTM1 TI process and trapping its return state;

NumericGlobalVariable('nRet');  

# Data ZeroOut

  sProc = 'Bedrock.Cube.Data.ZeroOut';

  nRet = ExecuteProcess ( sProc , 'pCube' , sCube ,'pFilter' , 'Version+Actual&Year+2009+2008' , 'pDebug' , pDebug );

  #Region "Block Audit"

  IF( nRet = ProcessExitNormal() );

    sRet = 'Process Completed Successfully';

  ELSEIF( nRet = ProcessExitByChoreQuit() );

    sRet = 'Exit by Chore Quit';

  ELSEIF( nRet = ProcessExitMinorError() );

    sRet = 'Exit with Minor Error';

  ELSEIF( nRet = ProcessExitByQuit() );

    sRet = 'Exit by Quit';

  ELSEIF( nRet = ProcessExitWithMessage() );

    sRet = 'Exit with Message';

  ELSEIF( nRet = ProcessExitSeriousError() );

    sRet = 'Exit with Serious Error';

  ELSEIF( nRet = ProcessExitOnInit() );

    sRet = 'Exit on Initiation';

  ELSEIF( nRet = ProcessExitByBreak() );

    sRet = 'Exit by Break';


  Endif;

  CellPutS( sRet ,'}Docu_Processes' , sProc , 'Process State' );

#End Region


Copyright 2011, bedrocktm1.org Tested on: TM1 Versions 9.1 to 10.2.1 / Cognos Express 9.0 to 10.2