The most common calculation in OLAP applications involves aggregating data along a dimension. In TM1®, you create these calculations using consolidation hierarchies. For example, in a Month dimension, you can define a quarterly consolidation that sums January, February, and March values.
In many applications, you also need to perform calculations that do not involveaggregating, such as generating cost allocations and calculating exchange rates. You can use rules to perform such calculations.
Using rules, you can:
* Multiply prices by units to yield sales amounts.
* Override consolidations when needed. For example, you can prevent a quarterly average price from displaying a tally of individual monthly prices.
* Use data in one cube to performcalculations in another cube, or share data between cubes. For example, you can pull sales data into a cube that contains profit and loss data.
* Assign the same values to multiple cells.
Each rule is associated with an individual cube. For example, if you create a rule to calculate values in the Purchase cube, the associated rule appears as a subordinate object of the Purchase cube in ServerExplorer. The Purchase rule calculates values only in the Purchase cube.
Compiled rules are stored in files called cube_name.rux. When a cube for which you have defined rules is loaded into memory, TM1 searches for the cube's .rux file in the data directory containing the cube.
When you create a rule, TM1 also generates a file called cube_name.blb, which contains format information for the RulesEditor.
If you want to edit a .rux file in another text editor, you should delete the corresponding .blb file. If you do not delete the file, there will be a discrepancy between the contents of the .rux file and the display in the Rules Editor, as the display of the Rules Editor is determined by the .blb file.
Note: When using rules and spreading, if the rules are such that the resultant value doesnot match the spread desired value, an error will be generated and the spread operation will not be done. See also the IBM CognosTM1 Installation and Configuration Guide SpreadingPrecision parameter for more information about spreading and rules.
Using Object Names with Special Characters in Rules Expressions
You should be aware that some special characters in object names may conflict when usedin a rules expression. For example, the @ character and exclamation point ! character are both valid characters for object names but are also used in rules expressions.
The @ character is a string comparison operator in rules. If you reference any object containing the @ character in rules, the object name must be enclosed in single quotation marks. For example, a dimension namedproducts@location must be referenced as 'products@location' in rules.
The exclamation point character is used as part of the !dimension argument in the rules DB function and should not be used in object names that will be used in rules.
You create and edit rules in the Rules Editor. The Rules Editor is basically a text editor that helps youcreate accurate cube references, with menu options and toolbar buttons to insert commonly used rule syntax, characters, and functions.
There are several ways to access the Rules Editor.
* When first creating a rule for a cube, right-click the cube in Server Explorer and click Create Rule.
* When a rule exists for a cube, right-click the cube in Server Explorer and click Edit Rule.
*When a rule exists for a cube, double-click the rule to open it for editing.
Note: Only one Rules Editor window can be opened for the same cube at a time.
Using the Rules Editor Window
The Rules Editor combines advanced code editing features with TM1® specific tools to help you create, manage, and verify your rules. This section provides an overview of the menus, toolbar buttons, and code...