Making a rule more general with #if - #else in Planning Business Modeler

You can use the #if-#else-#end preprocessor directives to make a single business rule work in different situations. For example, PerformancePoint Planning Business Modeler uses these directives to make a currency rule that works both for models with the Flow dimension, and for models without the Flow dimension. For more information on preprocessor directives, see Preprocessor directives (PEL).

These directives control the flow of execution for a rule based on a condition. The rule script that follows the #if directive is executed only if the condition that follows it is true. The optional #else directive provides a second condition that is executed when the #if statement is not true.

The #if preprocessor directive can test for any one of the following conditions

  • Dimension is in the model

  • Hierarchy is in the specified dimension

  • Level is in the dimension and hierarchy

The following example shows how to test whether the model includes the Flow dimension.

#if DimensionExists [Flow] 
// Statements to execute when model includes Flow dimension
#else
// Statements to execute when model does not have Flow dimension
#end

Example

The Currency rule template uses the #if-#else directive to make the template as general-purpose as possible. The following code shows the Currency Rule used by the Alpine Ski House sample application that is included with Planning Business Modeler. Comments have been added to explain actions.

SCOPE (ClassificationFilterInclude([Account], "Income statement", "Non financial"));
() += AVE * CURRENTTUPLE;
END SCOPE;
/* This segment of the rule applies only to models that include the Flow dimension. */
#if DimensionExists [Flow]
/* The rule then selects members with specified account types. */
SCOPE [Account].TypeFilterInclude("Cash", "Contra Asset LT", "Expense", "Expense IC", "Income", "Interco Pay ST", "Inventory", "Invest Income IC", "Investment", "LT Asset", "LT Liability", "ST Asset", "ST Liability");
/* The next selection criteria applies only to the members with certain account types that were selected in the previous SCOPE statement. */
SCOPE TypeFilterInclude([Flow], "Opening", "PY Adj");
() += OPE * CURRENTTUPLE;
([Flow].[All Members].[FXO]) += CLO * CURRENTTUPLE;
([Flow].[All Members].[FXO]) -= OPE * CURRENTTUPLE;
END SCOPE;
/* Additional statements for other account types and flow types */
END SCOPE;
/* #else directive applies only to models that do not include Flow dimension */
#else
SCOPE ClassificationFilterInclude([Account], "Balance Sheet");
() += CLO * CURRENTTUPLE;
END SCOPE;
#end

Top of Page

Share Facebook Facebook Twitter Twitter Email Email

Was this information helpful?

Great! Any other feedback?

How can we improve it?

Thank you for your feedback!

×