Highlight Exceptions Macro

A macro that highlights exceptions in a report.

Syntax

Function ExceptionMacro (DimensionLineSetting as String, RowLabel as String, ColumnLabel as String, LayerLabel as String, ExceptionName as String, ValueOfCell as Double) As Long ComparisonCode End Function

Discussion

Use this macro to add extra administrative functions, such as document security or statistical logging. After you specify the use of this macro in the Custom Exceptions dialog box, IBM® Cognos® PowerPlay® runs this macro function once for every cell in a report. For example, to highlight values in cells (with a particular exception style) that match a specified criteria, include the scripting in the ExceptionMacroName.mac file.

Requirements

  • The macro must include a function called ExceptionMacro.
  • The macro must be located in the Macro directory specified in the Preferences dialog box.
  • You can use this macro for one or more valid report file names.
  • PowerPlay runs this function once for every cell in the report, so do not include any code for the ComparisonCode parameter that shows message boxes because each message box will appear at least once for each cell. For example, an exception macro uses a message box to indicate that a cell is an exception. If the report has 2,400 cells whereby 1,834 cells meet the exception criteria, 1,834 messages will appear as each cell is tested.
  • Each time there is a change to a category, such as drilling down, adding a row, or performing calculations, PowerPlay runs the function again for every cell in the report.
  • An administrator should maintain this macro centrally in the Macros directory specified in the PowerPlay Preferences dialog box.

Parameters

Description

DimensionLineSetting

Required. Specifies the Dimension line settings that PowerPlay passes to the exception macro.

Type: String

RowLabel

Required. Specifies the Row label that PowerPlay passes to the exception macro.

Type: String

ColumnLabel

Required. Specifies the Column label that PowerPlay passes to the exception macro.

Type: String

LayerLabel

Required. Specifies the Layer label that PowerPlay passes to the exception macro.

Type: String

ExceptionName

Required. Specifies the name of the exception that PowerPlay passes to the exception macro.

Type: String

ValueOfCell

Required. Specifies the value of the cell that PowerPlay passes to the macro.

Type: Double

ComparisonCode

Required. Identifies whether the style associated with the exception is applied to a cell. The ExceptionFunction macro determines the value returned.

0 = do not apply the style 1 = apply the style

Type: Integer

Return Type

Long

Example

This example applies the exception style to each cell where the value in the cell is less than zero. When the macro returns a value of 1, it applies the style associated with the specified exception to the cell. When the macro returns 0, it does not apply the exception style to the cell.

Function ExceptionMacro (PPDimLine as String, PPRow as
String, PPCol as String, PPLayer as String, PPExName as String,
PPCellV as Double) As Long
  if PPCellV < 0 then
    ExceptionMacro = 1
  else
    ExceptionMacro = 0
  end if
End Function

Related Topics