CubeRuleSet

CubeRuleSet replaces the content of a cube rule with a specified string. This function is valid only in Planning Analytics processes.

Syntax

CubeRuleSet(RuleName, RuleString);

Argument

Description

RuleName

The name of the cube rule for which you want to replace content. You do not need to specify the .rux file extension.

If the rule does not exist on the database where the process is executed, a new rule is created upon execution of this function, containing the rule statements included in the RuleString.

RuleString

A single text string containing the rules statements that you want to write to the cube rule.

The entire string must be enclosed in single quotes and must adhere to rules syntax conventions.

If the string includes any member references, the member names must be enclosed in double single quotes to escape the single quotes that normally enclose member names in a rule. For example, a reference to a member named CL3 must be specified as [''CL3'']

Example

CubeRuleSet('RevenueRule', '[''Gross Margin %'']=c: ([''Gross Margin'']\[''Gross Revenue''])*100; [''Unit Price''] = c: [''Gross Revenue'']\[''Units Sold'']; [''Unit Cost''] = c: [''Cost of Sales'']\[''Units Sold''];');

Note that all member references in the RuleString are enclosed in double single quotes to escape the single quotes that normally enclose member names.

This example replaces any existing content in RevenueRule with these three lines:

['Gross Margin %']=c: (['Gross Margin']\['Gross Revenue'])*100;
['Unit Price'] = c: ['Gross Revenue']\['Units Sold'];
['Unit Cost'] = c: ['Cost of Sales']\['Units Sold'];

If RevenueRule does not already exist, it is created on the database where the process is executed.