Professional Documents
Culture Documents
Chris Barbieri
Consolidation Practice Director Oracle ACE Ranzal & Associates
*With significant content from JimTheRulesGuy Heflin & Geordan Drummond of Ranzal
Topics
Basics of HFM rules in classic Vbscript Advanced topics in classic mode Debugging Intro to Calc Manager Questions ?
HFM Rules
The basics
The HS.Exp function is used to write data to the database HFM destination = source data from HFM The HS.GetCell function is used to retrieve data from the database A variable = data from HFM
Tip 1: Know what dimensions are valid on each side of the equation.
On the left hand side: The current point of view is set, these dimensions cannot be specified:
Scenario Year Period Entity Value
In the following dimensions you can only write to a base level elements: elements
Account ICP Custom1 Custom2 Custom3 Custom4 So only base members on the left hand side
Tip 6: If you can not specify a dimension on left hand side of the equation, then control when the statements are run.
If HS.Period.IsFirst = True Then HS.Exp A#BegRetainedEarnings & _ = A#EndRetEarn.Y#Prior.P#Last & _ + A#NetIncome.Y#Prior.P#Last.W#YTD End If
HFM Scenarios are not linked like the Category in Enterprise but the system does know the sequence of the year dimension Note: You can get in trouble if you run this rule on the first year in the system!
Be careful when writing to the database that you are not pushing 0s into the database A zero is data which is not the same as nothing. What do you think will happen when you run a Consolidate all with Data? This has a negative effect on performance This can very quickly bloat the database size
Before
After
Before
After
SomeVariable = HS.GetCell("A#Account4.C1#Computers") * 1.1 If SomeVariable <> 0 Then HS.Exp "A#Account3.C1#Computers = " & SomeVariable End If
HFM Rules
Advanced Topics and Debugging
Tip 1: The calculate sub procedure may be run several times per entity.
Unless restricted, Sub Calculate can run up to eight times per entity May accidentally end up with double or triple the desired value Even if its correct, it simply takes unnecessary time
[Contribution Total] [Contribution] [Proportion] [Parent Total] [Parent] <Parent Currency Total> <Parent Currency> <Entity Currency Total> <Entity Currency> <Entity Curr Adjs> <Parent Curr Adjs> [Parent Adjs] [Contribution Adjs] [Elimination]
<Entity Currency>
Rules are not run and you cant write to <Entity Currency Total> (1) and (2) are entirely independent of each other Avoid reading from outside the data unit Definitely avoid reading Calculated values from outside the data unit.
Tip 1: Debugging
The Editor will help you. Save time Format code Syntax check code Use VB functions The editor knows what parameters are required etc. Has color coding
If you dont document code, it is very difficult for anyone to help you Undocumented code is difficult to maintain (modify later) Your future audience may be you!
Dont make your variables a secret code If the variable is holding average daily sales call it something like:
AvgDaySales average_daily_sales
Resources
HFM Rules course from Oracle Education VBA for Dummies
Nice overview of programming and VBA.
VBScript in a Nutshell
by Childs, Lomax, & Petrusha, published by OReilly, is a really handy syntax reference when coding.
This works
HS.Exp "A#AvgWorkCap" & Nones & "=" & (sum_wc / 13)
Also used for currency restatement scenarios Performance-wise, this is expensive so use wisely and sparingly
You can turn types of rules on and off Cuts down on repetitive code Helps with debugging Overall code is more readable Calc Manager is designed for this approach
Not natively part of HFM, but used so often most people think it is Added functionality directly into Calc Manager
File output is from the HFM app servers perspective and owned by the DCOM user
Create a file share for this
This is a snapshot of the text output I was just trying to see what data was in each of the value dimensions at a particular time The Time / Date Stamp is coded into the output, and is automatic
Overview
Web-based, object-oriented module that creates:
HFM rules Planning Business Rules
Overview
How is this different from todays rules? In the end the logic is still the same for HFM
Calc Mgr creates and stores the visual representation During deployment an .rle file is created from the objects and loaded to HFM Deployment is equivalent to todays step of loading rules VBScript also be generated on demand to validate what will be created during deployment
Object Hierarchy
RuleSets
Rules *
Components
* Rules can also contain other nested Rules
Rule Sets
RuleSets
Are equivalent to major subroutines (e.g. Calculate, Consolidate, Translate, NoInput, etc.) Only one RuleSet per Calculation Type can be deployed at once but multiple versions can be created and stored RuleSets perform Calls for all of the individual rules
Rules
Rules
Are equivalent to custom subroutines that are called from main subroutines Where all of the actual code is actually housed
Script
Allows VBScript to be written for part of a rule rather than using the GUI interface
Condition
Used to wrap a conditional statement around other components (e.g. If pov_entity = x then.)
Member Range
A list of items that can be looped through, such as a member list
Data Range
Equivalent to Open Data Unit loops
Fixed Loop
A numbered series that can be looped through (e.g. For i = 1 to 10)
Features (Demo)
On-demand conversion to VBScript
Done at the Rule or RuleSet level allows you to see the code that will be generated upon deployment Can not be modified and converted back to Component objects but assists in troubleshooting
Commentary available in numerous places Logging (aka Write to File) Timer Disable equivalent to commenting out a line Member, function and variable selection throughout
Replacement Variables
Typically used for constants like static strings Need to be declared through the Variable dialogue box before use
Execution Variables
Typically used for situations in which variable is populated or reset as part of a rule (e.g. Open Data Unit members) Need to be declared through the Variable dialogue box before use Scope can be at RuleSet or Rule level
Other Features
Sharing Expand/Collapse Zoom Levels Printing
Create from scratch using new graphical objects Place the rules into script objects Use a conversion utility to migrate from VB Script to Calculation Manager objects
Benefits
What are the benefits of using Calculation Manager? Easier to maintain for administrators Doesnt require quite as much coding knowledge (but still requires app knowledge) More transparent way to explain calculations to auditors or for documentation purposes Shared objects can be used in multiple situations and multiple applications Templates allow for the faster creation of the most commonly used rules and the benefit of leveraging best practices
Questions?
Chris Barbieri
cbarbieri@ranzal.com Needham, MA USA +1.617.480.6173 www.ranzal.com