You are on page 1of 198

Hyperion Financial Management 9.3.

1 Create Rules
Student Guide

D52786GC10 Edition 1.0 January 2008 D53155

a r O

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Author
Mark Mitsock

Copyright 2008, Oracle. All rights reserved. Disclaimer This document contains proprietary information and is protected by copyright and other intellectual property laws. You may copy and print this document solely for your own use in an Oracle training course. The document may not be modified or altered in any way. Except where your use constitutes "fair use" under copyright law, you may not use, share, download, upload, copy, print, display, perform, reproduce, publish, license, post, transmit, or distribute this document in whole or in part without the express authorization of Oracle. The information contained in this document is subject to change without notice. If you find any problems in the document, please report them in writing to: Oracle University, 500 Oracle Parkway, Redwood Shores, California 94065 USA. This document is not warranted to be error-free. Restricted Rights Notice

Technical Contributors and Reviewers


Keith Glide Jennifer Hough Daniel Tijerina

Editor
Susan Moxley

Graphic Designer
Carisa Cannan

If this documentation is delivered to the United States Government or anyone using the documentation on behalf of the United States Government, the following notice is applicable: U.S. GOVERNMENT RIGHTS The U.S. Governments rights to use, modify, reproduce, release, perform, display, or disclose these training materials are restricted by the terms of the applicable Oracle license agreement and/or the applicable U.S. Government contract. Trademark Notice Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners.

Publisher
Judy Gaitan

a r O

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Table of Contents

Preface
Course Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . vii Course Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . viii Course Materials . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . viii Student Guide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . viii Activity Guide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . viii Conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ix

Module 1: Financial Management Rules Basics Lesson 1: Reviewing Rules Syntax


About Rules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-2 Describing Objects and Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-3 Creating Rules Expressions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-8 HS.Exp Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-8 Account Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-10 Destination Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1-11 Source Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1-11 Adding Operators and Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-12 Period and Year Keywords . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-13 Placing Other Functions Within Exp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-13 Identifying Rule Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-14 Identifying Sub Procedures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-16 Adding Comments to Rules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-18 Inserting Line Continuations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-19 Creating Conditional Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-21 Applying If...Then...Else Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-22 Making Decisions with Select Case Statements . . . . . . . . . . . . . . . . . . . . . . . . . 1-24 Comparing Strings in Financial Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-25 UCase Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-26 LCase Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-26 Left Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-26 Right Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-27

a r O

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Table of Contents

Lesson 2: Reducing Maintenance with Variables


About VB Script Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-2 Creating Variables and Assigning Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-3 Variables and Data Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-5 Variables and Constants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-7 Creating Header Sections for Variables and Constants. . . . . . . . . . . . . . . . . . . . . . . . 2-9 Point of View Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-10 Top and None Members for Custom and ICP Dimensions . . . . . . . . . . . . . . . . . 2-10 Global Accounts. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-11 Conditional Statement Triggers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-11

Lesson 3: Managing the Scope of Rules


Subcubes and Data Retrieval . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-2 Financial Management Subcubes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-3 Subcube Dimensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-4 Subcubes and Performance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-5 Subcubes and Rules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-7 The Left Side of HS.Exp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-7 Page Dimensions and HS.Exp. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-9 Managing the Scope of Rules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-11 Omitting Dimensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-12 Specifying the Destination Dimensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-13 Specifying Source Dimensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-14 Mismatched Custom Dimensions (Example 1) . . . . . . . . . . . . . . . . . . . . . . . . . . 3-15 Mismatched Custom Dimensions (Example 2) . . . . . . . . . . . . . . . . . . . . . . . . . . 3-17 Executing Rules with the Value Dimension . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-19 Sub Calculate and the Value Dimension . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-21 Working with Total Members . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-23

Lesson 4: Creating Rules for Dynamic Accounts

Dynamic Account Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Sub Dynamic Procedures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Creating Rules for Dynamic Accounts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Functions Valid with HS.Dynamic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

a r O
iv

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

4-2 4-3 4-4 4-6

Hyperion Financial Management 9.3.1: Create Rules

Table of Contents

Module 2: Creating Procedures, Loops, and Arrays Lesson 5: Creating Custom Procedures
Creating Custom Sub Procedures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-2 Calling Custom Sub Procedures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-4 Creating Custom Function Procedures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-6 Calling Custom Function Procedures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-8 Troubleshooting with Logging Procedures. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-9 Writing to Log Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-10 Calling Write to File Procedures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-14 Managing Log Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-16 DeleteFile Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-17 FileExists Function. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-17 GetFile Function. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-17 MoveFile Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-18 Size Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-18

Lesson 6: Creating Arrays and Loops

Arrays. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-2 Loops . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-3 Arrays and Loops in Rules. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-4 Creating Array Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-6 Filling Arrays Using Member Lists . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-7 Creating Loops. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-8 For...Next . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-8 For Each...Next . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-9 Do...Loop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-10 Assigning Values with Arrays and Loops . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-12 Attributes in Loops . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-14 Loops and Data Units . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-15 Opening Data Units . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-16 Creating Loops With Data Units. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-18

Module 3: Working with Data and Hierarchies

a r O

Lesson 7: Managing Financial Management Data


Retrieving and Writing Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-2

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

Table of Contents

Testing for No Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-4 Setting Accounts to No Input . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-6 Setting Parent Entities to Input . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-8 Rounding and Scaling Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-10 Rounding and Scaling with HS.Round. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-12

Lesson 8: Working with Dimension Hierarchies


Working with the Calendar. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-2 Preventing Prior and Next from Crossing into Invalid Years . . . . . . . . . . . . . . . . . 8-3 Populating Days in Period Accounts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-5 Managing Calculation Status . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-6 Managing Movement Accounts and Data Views . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-8 Avoiding Circular Calculations in Hierarchies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-10 Creating Allocations Using Sub Allocate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-12 Running the Sub Allocate Procedure. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-13 Using the Alloc Function to Create Allocation Rules . . . . . . . . . . . . . . . . . . . . . . 8-15

Module 4: Creating Custom Translations and Consolidations Lesson 9: Creating Currency Translation Rules

About Translating Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-2 Currency and Exchange Rate Settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-3 Translation Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-5 Default Translation Process . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-7 Creating Custom Translation Rules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-9 Translation Functions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .9-11 Calculating Exchange Differences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-13 Working with Currency Overrides . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-15

Lesson 10: Creating Consolidation and Elimination Rules


Default Consolidation Calculations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-2 Creating Consolidation Rules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-4 Consolidation Functions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-5 Consolidation Procedure Example. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-9 Testing for Eliminations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .10-11

a r O
vi

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

Preface

Welcome to Hyperion Financial Management 9.3.1: Create Rules! Before you begin, please take a moment to review this section. The preface presents an overview of: The course objectives The course structure The course materials Writing conventions used in this manual Additional resources to enhance your learning

Relevant follow-up courses you might want to attend in the future

Course Objectives

a r O

e l c

e l c a r O ly & On l a e n r s e t U n I
Create allocation rules Create custom currency translation rules

After completing this course, you should be able to:

Reduce database size and calculation time by proper use of the custom and value dimensions in rules Calculate percentages and ratios using rules for dynamic accounts Create custom procedures, functions, loops, and arrays in rules Create rules with proper data handling techniques

c A

e d a

y m

Create custom consolidation and elimination rules

Preface

Course Structure
Hyperion Financial Management 9.3.1: Create Rules is a 3-day, instructor-led training course consisting of lectures, demonstrations, and hands-on exercises. In this course, the instructor presents a topic conceptually by explaining its purpose, demonstrating how it works, and then guiding the students through the exercises. Demonstrations and hands-on exercises reinforce the concepts and skills introduced during lectures.

Course Materials
You use two books in classthe student guide and the student workbook. The instructor may also give you handouts.

Student Guide
The student guide is designed to be used by students and the instructor during lecture time. It has four modules: Module 1 describes the basics of Financial Managment rules. Module 2 describes how to create custom Sub and Function procedures. You learn to create rules using arrays and loops. Module 3 describes how to work with Financial Management data and hierarchies. Module 4 describes how to customize the default currency translation and consolidation calculations.

Each module contains lessons. Each lesson begins with a list of objectives followed by the presentation of slides and accompanying text. The lesson ends with a summary of the topics covered in the lesson. A glossary provides definitions of terms used during the course.

Activity Guide

The activity guide has two sectionsexercises and exercise solutions. Exercises A critical part of the learning process is the challenge of completing real tasks associated with each lesson. Each exercise is an opportunity to apply your new knowledge.

a r O
viii

Exercise Solutions The exercise solutions present the detailed steps to successfully complete the exercises.

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

Preface

Conventions
The following text conventions are used in this course book: Text to be typed, options to be selected, names of files and modules, and menu selections are displayed in bold type. Examples: - Select Clear Profile. - To clear the profile, click Yes. Keyboard shortcuts are displayed as follows: Ctrl+Enter For the example, you would press the Ctrl key and the Enter key at the same time. Tips and Notes are used to direct your attention to different types of information.
NOTE

A note provides related information, common mistakes, and cautions about the current topic.

a r O

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

ix

Preface

a r O
x

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

M O D U L E

1
0

Financial Management Rules Basics

Overview
In this module you learn the basics for creating Financial Management rules. Lessons in this module include: Reviewing Rules Syntax Reducing Maintenance with Variables Managing the Scope of Rules Creating Rules for Dynamic Accounts

a r O

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

a r O

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

L E S S O N

1
1

Reviewing Rules Syntax

Objectives
At the end of this lesson, you should be able to: Explain the purpose of rules in Financial Management Describe objects and functions in expressions Create rules expressions Identify Financial Management rule types Distinguish between Sub procedures Add comments and line breaks Create conditional statements and compare strings

a r O

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Module 1 Financial Management Rules Basics Lesson 1 Reviewing Rules Syntax

About Rules
Hyperion Financial Management rules provide powerful, customized calculations that you can use to perform the following tasks: Calculate data that cannot be calculated through a hierarchical aggregation, such as ratios or variance analyses Perform complex currency conversions and calculate exchange rate differences or other calculations necessary for consolidation Prevent data entry for a specific cell Perform allocations from a parent entity to a list of base entities Enable data entry to a parent entity Perform custom consolidations for statutory reporting requirements

Copyright 2008, Oracle. All rights reserved.

About Rules

You use rules to perform calculations that you cannot define through parent-child relationships in the dimension hierarchy. For example, you can create a rule to calculate the value of the Salaries member by multiplying the Headcount member by the SalaryRate member.

a r O
1-2

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

Module 1 Financial Management Rules Basics Lesson 1 Reviewing Rules Syntax

Describing Objects and Functions


Objects represent elements of a Financial Management application, such as dimensions. Functions represent actions that a rule can perform, such as retrieving a value. You write rules statement by applying functions to objects. Not all functions are valid for all objects.
Object Function This statement uses the DefCurrency function to retrieve the default currency of an entity. The DefCurrency function is invalid here because scenarios do not have currencies.

HS.Entity.DefCurrency

HS.Scenario.DefCurrency

Copyright 2008, Oracle. All rights reserved.

Describing Objects and Functions

A programming language consists of its own vocabulary and grammar. Objects are equivalent to nouns in programming languages. For example, in Financial Management, the Entity object represents the Entity dimension, the Account object represents the Account dimension, and so on. Functions are the verbs that express the actions of a programming language. To create rules, you should be familiar with these basic principles about objects: Objects contain their own sets of functions. For example, you can use certain functions only with the Period object. Objects can be children of other objects. For example, the top-level object in Financial Management is named HS. The HS object contains some functions and several other objects. When you write rules, you use dot notation (dot) to separate objects from other objects and functions. 1-3

a r O

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

Module 1 Financial Management Rules Basics Lesson 1 Reviewing Rules Syntax The following table lists the functions by object for Financial Management rules:
Object HS Function ABSExp Alloc CalcStatus Clear Con Exp Dynamic GetCell GetCellNoData GetCellRealData GetCellType GetRate ImpactStatus Input NoInput NoRound OpenDataUnit ReviewStatus Round SetData SetDataWithPOV Trans TransPeriodic

Account

a r O
1-4

e l c

e l c a r O ly & On l a e n r s e t U n I

AccountType C1...4 Top IsBase IsChild IsConsolidated IsDescendant IsICP List NumBase NumChild NumDescendant PlugAccount SecurityClass UD1...3 ValidationAccount XBRLTags

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

Module 1 Financial Management Rules Basics Lesson 1 Reviewing Rules Syntax


Object AppSettings Function Currency ICPWeight PVAForBalance PVAForFlow RateForBalance RateForFlow Scale IsBase IsDescendant List NumBase NumChild NumDescendant SecurityClass SwitchSign SwitchType UD1...3 GetItem GetItemIds2 GetNumItems AllowAdjs AllowAdjsFromChildren DefCurrency Holding IsBase IsChild IsDescendant IsICP List Member NumBase NumChild NumDescendant SecurityAsPartner SecurityClass UD1...3 List

Currency Custom1, Custom2, Custom3, and Custom4

DataUnit

Entity

ICP

a r O

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

1-5

Module 1 Financial Management Rules Basics Lesson 1 Reviewing Rules Syntax


Object Node Function Consol1...3 DOwn IsBase IsChild IsDescendant List Method NumBase NumChild NumDescendant PCon POwn DefCurrency Holding IsBase IsChild IsDescendant IsICP List Member NumBase NumChild NumDescendant UD1...3

Parent

Period

Scenario

a r O
1-6

e l c

e l c a r O ly & On l a e n r s e t U n I
IsFirst IsLast List Member NumBase Number ConsolidateYTD DefaultFreq DefaultView List Member NumPeriods SecurityClass UD1...3

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

Module 1 Financial Management Rules Basics Lesson 1 Reviewing Rules Syntax


Object Value Function Currency IsTransCur IsTransCurAdj Member IsFirst IsLast Member

Year

a r O

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

1-7

Module 1 Financial Management Rules Basics Lesson 1 Reviewing Rules Syntax

Creating Rules Expressions


You can create rules expressions to assign values to accounts: You use the HS.Exp function with an account expression to assign values to accounts. HS.Exp expects a destination value on the left side and a source value on the right side of the equal sign.
HS.Exp "Destination=Source"

You can use account expressions within Exp to specify the source and destination values.

Copyright 2008, Oracle. All rights reserved.

Creating Rules Expressions

You create rules expressions by using Financial Management objects and functions to perform these types of tasks: Calculating data

Consolidating data

Setting accounts to read-only

HS.Exp Function

The most frequent use of a rule expression is assigning values to accounts. Use the HS.Exp function to assign values to accounts.

a r O
1-8

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

Module 1 Financial Management Rules Basics Lesson 1 Reviewing Rules Syntax Use this syntax: HS.Exp DestinationValue = SourceValue The following example sets the Cash account to 50,000: HS.Exp "A#Cash = 50000

a r O

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

1-9

Module 1 Financial Management Rules Basics Lesson 1 Reviewing Rules Syntax

Account Expressions
An account expression uses a dimension keyword to specify a value or a set of values. A dimension keyword is separated from its values by a pound sign (#).
A#NetIncome

Dimensions are separated by periods.


A#Cash.P#January.E#USA.C1#OpeningBalance

Copyright 2008, Oracle. All rights reserved.

Account Expressions

Account expressions identify cells in the database by specifying one or more dimension members. The Exp function requires an account expression on the left (destination) side of the equal sign. The right (source) side of the equal sign can be an account expression, a constant value, or any function that returns a numeric value. Dimension Keywords An account expression uses a dimension keyword to specify a value or a set of values. A dimension keyword is separated from its values by a pound or hash sign (#), and dimensions are separated by dots. For example: A#Cash.P#January.E#USA.C1#OpeningBalance

a r O
1-10

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

Module 1 Financial Management Rules Basics Lesson 1 Reviewing Rules Syntax The table lists the dimension keywords that you can use to specify dimension members:
Keyword S# Y# P# V# E# W# A# I# C1# C2# C3# C4# Description Scenario Year Period Value Entity View Account Intercompany Partner Custom1 Custom2 Custom3 Custom4

Destination Expressions

The destination for the Exp function is specified by the Account, Custom, and ICP members specified on the left side of the equal sign. The destination Entity, Period, Year, Value, members are determined by the current point of view (POV) members or by the cells selected on the data grid or form. The members for the currently selected cells on the grid override the current POV members. The destination View member is the current scenario default view, regardless of the currently select POV members.

Source Expressions

When you use an account expression on the right side of the equal sign with Exp, you can specify any dimension member. If you do not specify a Entity, Period, Year, or Value dimension member, the current POV member or the current cells selected on the grid or data form are used. If you do not specify a View member, the source is the current scenario default view, regardless of the currently select POV member.

a r O

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

1-11

Module 1 Financial Management Rules Basics Lesson 1 Reviewing Rules Syntax

Adding Operators and Functions


You can use standard math operators on the right side of the equal sign.
HS.Exp "A#Sales = A#Units * A#Price"

You can use Period and Year keywords for dynamic time calculations.
HS.Exp "A#MiscPast = A#Misc.Y#Cur-2"

You can embed other HS functions within Exp.


HS.Exp "A#AvgSales = A#Sales/HS.Entity.NumBase(USA)"

Copyright 2008, Oracle. All rights reserved.

Adding Operators and Functions

You can add, subtract, multiply, and divide on the right side of the equal sign. You must use the following standard VBScript characters: + - * / If you multiply or divide with an account that has a NoData status, the data in the account on the left side of the equal sign is not changed. Zero is considered data. An account that contains 0.00 as data does not have a NoData status. The following example sets the amount in the StateTax account. This example calculates the StateTax amount by multiplying the amount in the Sales account for 2005 by the rate in the StateRate account for 2005: HS.Exp "A#StateTax = A#Sales.Y#2005 * A#StateRate.Y#2005"

a r O
1-12

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

Module 1 Financial Management Rules Basics Lesson 1 Reviewing Rules Syntax

Period and Year Keywords


To create dynamic rules, you can use the following keywords, instead of member names, to represent members of the destination Year or Period dimension:
Keyword Cur First Last Next Prior Description Current period or year First period or year that is valid for the application Last period or year that is valid for the application Period or year that follows the current period or year Period or year that precedes the current period or year

You can use plus (+) and minus (-) with the Period and Year keywords. The following example sets the MiscPast account to the amount in the Misc account two periods before the current period: HS.Exp "A#MiscPast = A#Misc.P#Cur-2"

Placing Other Functions Within Exp

If an HS function returns a single numeric value, you can nest the function in the Exp function. However, if you nest a function that contains a string argument, you cannot enclose the string in quotation marks. In the following example, the NumBase function is nested in the Exp function to retrieve the number of base entities for the Regional member: HS.Exp "A#SalesAlloc = A#Sales/HS.Entity.NumBase(Regional)" Notice that the Regional string is not enclosed in quotation marks.

a r O

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

1-13

Module 1 Financial Management Rules Basics Lesson 1 Reviewing Rules Syntax

Identifying Rule Types


There are eight types of rules in Financial Management:
Calculate Dynamic Translate Allocation Input No Input Consolidate Transactions
Sub Calculate() HS.Exp "A#TargAcct=A#SourceAcct End Sub Sub NoInput() HS.NoInput"A#Sales.S#Budget End Sub

You place the rules for each type in a separate sub procedure in the rules file.

Copyright 2008, Oracle. All rights reserved.

Identifying Rule Types


Rules fall into eight types:

Calculate rules are executed when you perform calculations and consolidations. You use calculate rules for these tasks: Set and clear values from accounts Perform ad hoc calculations

Conform to statutory requirements

a r O
1-14

Dynamic rules enable you to create ratios that accurately calculate parent values for the Period, VIew, and custom dimensions. Parent values for percentages for these dimensions are not accurately calculated by the aggregation of base member values. Translate rules execute when you perform translations. These rules can override default translation calculations.

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

Module 1 Financial Management Rules Basics Lesson 1 Reviewing Rules Syntax Allocation rules execute when you allocate data from a single source to multiple destinations. Input rules enable input at the parent entity level. No input rules prevent input at the base entity, account, and custom level. Consolidate rules perform nonstandard consolidations. These rules are most commonly found in statutory applications. Transactions rules enable posting to accounts and scenarios from the Intercompany Transactions module.

a r O

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

1-15

Module 1 Financial Management Rules Basics Lesson 1 Reviewing Rules Syntax

Identifying Sub Procedures


A Sub procedure is a series of VBScript statements (enclosed by Sub and End Sub statements) that performs actions but does not return a value.
Sub Calculate() HS.Exp "A#TargAcct=A#SourceAcct End Sub Sub NoInput() HS.NoInput "A#Sales.S#Budget End Sub

Copyright 2008, Oracle. All rights reserved.

Identifying Sub Procedures

A Sub procedure can take arguments (constants, variables, or expressions passed by a calling procedure). If a Sub procedure has no arguments, its Sub statement must include an empty set of parentheses (). Rules of each type are grouped into Sub procedures in the rules file. Rules statements are grouped into the following procedures:
Routine Translate() Allocate() Executed

Calculate() and Dynamic()

a r O
Input()

e l c

e l c a r O ly & On l a e n r s e t U n I
When you translate data When the application is opened.

c A

e d a

y m

When you calculate or consolidate data

When you use the Allocate option in a data grid

1-16

Hyperion Financial Management 9.3.1: Create Rules

Module 1 Financial Management Rules Basics Lesson 1 Reviewing Rules Syntax


Routine NoInput() Transactions() Consolidate() Executed When the application is opened. Automatically prevent you from entering data in specific cells When the application is opened. When you run a consolidation.

The routines are created in any order. Use the following syntax to define each routine: Sub Calculate() <All calculate rules are displayed here.> End Sub Sub Dynamic() <All dynamic rules are displayed here.> End Sub Sub Translate() <All translate rules are displayed here.> End Sub Sub Allocate() <All allocation rules are displayed here.> End Sub Sub NoInput() <All no input rules are displayed here.> End Sub Sub Consolidate() <All consolidate rules are displayed here.> End Sub Sub Input <All input rules are displayed here.> End Sub Sub Transactions() <All transactions rules are displayed here.> End Sub

a r O

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

1-17

Module 1 Financial Management Rules Basics Lesson 1 Reviewing Rules Syntax

Adding Comments to Rules


You can insert comments in rules files to: Document the purpose and results of procedures Provide detail information for other administrators who may inherit rules files you created Act as a reminder of what you may need to modify in future releases of Financial Management
Comment Routine is executed when user calculates or consolidates data. Sub Calculate() HS.Exp "A#TargAcct=A#SourceAcct End Sub Sub NoInput() HS.NoInput"A#Sales.S#Budget End Sub
Copyright 2008, Oracle. All rights reserved.

Adding Comments to Rules

Documentation in Financial Management rules files is considered almost as important as the code itself. Without documentation, administrators have a difficult time interpreting and troubleshooting another administrators procedures. Even if you are the only one maintaining the rules files, without proper documentation you can easily forget the intent of the procedure. Text preceded with an single quote() is interpreted as a comment. Although you can start comments anywhere within a line, it is recommended that you place a comment on its own line. This ensures that the line is properly validated. This is an example of inserting comments in your rules files:

a r O
1-18

' * Copy Actual Q1 rates to Q_Forecast If HS.Scenario.Member = "Q_Forecast" and HS.Period.IsFirst Then HS.Clear "A#ALL" HS.Exp "A#ALL = S#Actual" End If 'HS.Scenario.Member = "Q_Forecast" and HS.Period.IsFirst Hyperion Financial Management 9.3.1: Create Rules

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Module 1 Financial Management Rules Basics Lesson 1 Reviewing Rules Syntax

Inserting Line Continuations


Line Continuation: Uses an ampersand (&) for concatenation Uses an underscore (_) for line continuation Note: You must have a space between the ampersand and the underscore.
Concatenation

Line Continuation Syntax

Copyright 2008, Oracle. All rights reserved.

Inserting Line Continuations

You can use line continuation so that the entire string can be viewed without having to scroll to the right of the code window. If you must break a line into multiple strings, place the line continuation character between the strings, and then concatenate them using the ampersand (&). It is critical to preserve all spaces in the string when it is concatenated.
NOTE

You cannot use the line continuation character in comments, you must repeat the comment character apostrophe () at the beginning of each comment string line.

a r O

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

1-19

Module 1 Financial Management Rules Basics Lesson 1 Reviewing Rules Syntax Line Continuation Tips Break complex formulas at a point where a line performs an action. If you include long dimension names in the code line, break the line to show one account per line. Insert the mathematical operators at the beginning of the line so that you can identify what type of action is being applied to the account in the formula. When the line break is applied, the operators and account are split in a logical manner.

a r O
1-20

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

Module 1 Financial Management Rules Basics Lesson 1 Reviewing Rules Syntax

Creating Conditional Statements


The following condition statements are used in rules files: IfThenElse Select CaseElse

Copyright 2008, Oracle. All rights reserved.

Creating Conditional Statements

You can control the flow of your script with conditional statements. You can write VBScript that makes decisions and repeats actions.

a r O

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

1-21

Module 1 Financial Management Rules Basics Lesson 1 Reviewing Rules Syntax

Applying the IfThenElse Statement


The most common form of the If...Then...Else statement is the block form which allows for several lines of code to be executed or several comparisons to be made, within the one statement.

If HS.Scenario.Member = "Budget" Then HS.EXP "A#Sales = A#UnitsSold * A#Price" End If If HS.Scenario.Member = "Budget" Then HS.EXP "A#Sales = A#UnitsSold * A#Price" ElseIf HS.Scenario.Member = "Actual" Then HS.EXP "A#Price = A#Sales / A#UnitsSold" Else HS.EXP "A#Sales = A#Sales.P#Prior * 1.1" End If

Is executed only if the current member is Budget

Uses ElseIf to test for more than one condition

Copyright 2008, Oracle. All rights reserved.

Applying If...Then...Else Statements

The If...Then...Else statement allows several lines of code to be executed or several comparisons to be made within the one statement. You use the If...Then...Else statement to evaluate whether a condition is true or false and, depending on the result, to specify one or more statements to run. The condition is typically an expression that uses a comparison operator to compare one value or variable with another. You can nest If...Then...Else statements to as many levels as needed. Use and ElseIf...Then statement to add conditions.

For If...Then...Else statements that have multiple conditions, the first statement that evaluates to true is executed. Any conditions that follow are not evaluated or executed.

a r O
1-22

If you include an Else statement, the lines of script after the Else statement execute if none of the condition are met.

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

Module 1 Financial Management Rules Basics Lesson 1 Reviewing Rules Syntax The examples shown on the slide illustrate If...Then...Else statements: The first example verifies whether the scenario member is equal to Budget. If equal (true), a calculation multiplies Units Sold by Price, and the result is applied to the Sales account. If the condition evaluates to false, no calculation is performed. The second example applies the ElseIf statement if the scenario member is equal to Actual instead of Budget. If equal (true), a calculation divides Sales by UnitsSold and applies the result to Price. If the scenario is any member other than actual or budget, the calculation following the Else statement is performed.

a r O

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

1-23

Module 1 Financial Management Rules Basics Lesson 1 Reviewing Rules Syntax

Making Decisions with Select Case Statements


A Select Case structure works with a single test expression that is evaluated once, at the top of the structure. The result of the expression is then compared with the values for each Case in the structure. If there is a match, the block of statements associated with that Case is executed, as in the following example.

Copyright 2008, Oracle. All rights reserved.

Making Decisions with Select Case Statements

The Select Case structure provides an alternative to If...Then...ElseIf for selectively executing one block of statements from among multiple blocks of statements. A Select Case statement provides capability similar to the If...Then...Else statement, but makes code more efficient and readable when there are a large number of conditions to evaluate. The first Case statement that evaluates to true is executed. Any Case statements that follow are not evaluated or executed.

a r O
1-24

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

Module 1 Financial Management Rules Basics Lesson 1 Reviewing Rules Syntax

Comparing Strings in Financial Management


The following are four frequently used string functions: UCase
If UCase(HS.Entity.Member)="NONE" Then

LCase
If LCase(HS.Scenario.Member)= "budget" Then...

Left Function
Dim Product1, RtnString Product1 = "Financial Management" ' Define string. RtnString = Left(Product1, 9) ' Returns "Financial"

Right Function
Dim Product1, RtnString Product1 = "Financial Management" ' Define string. RtnString = Right(Product1, 10) ' Returns Management"

Copyright 2008, Oracle. All rights reserved.

Comparing Strings in Financial Management

String comparisons are important in Financial Management for these reasons: 1. To avoid simple errors in uppercase or lowercase strings when conditional statements are used. For example, the string 'Budget' is used as the dimension member, but you enter 'budget' for the comparison (one uses an upper case B and the second one uses a lower case b). With string comparison, if you always type lowercase and then convert variables and function results to lowercase you will not have mismatches. 2. You can use string comparisons to check for one or more characters that use a prefix or suffix in member names. This is useful for chart of accounts or entity structures that use coding in labels. For example, You use a product dimension and all hardware product member labels start with H100. You can create a string comparison to check the first 4 characters of the member label and if it equals H100 then do the calculation.

a r O

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

1-25

Module 1 Financial Management Rules Basics Lesson 1 Reviewing Rules Syntax

UCase Function
Returns a string that was converted to uppercase. Syntax UCase(String) Arguments String: A text string or a function that returns a text string. Example If UCase(HS.Scenario.Member)=ACTUAL Then Only lowercase letters are converted to uppercase; all uppercase letters and nonletter characters remain unchanged.

LCase Function
Returns a string that was converted to lowercase. Syntax LCase(String) Example If LCase(HS.Scenario.Member)=actual Then

Only uppercase letters are converted to lowercase; all lowercase letters and nonletter characters remain unchanged.

Left Function

Returns a string containing a specified number of characters from the left side of a string. A left function contains two required parts:

Use String to return the requested values.

Use Length (numeric value) to determine the number of characters to return. Syntax

Left(String,Length)

a r O
1-26

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

Module 1 Financial Management Rules Basics Lesson 1 Reviewing Rules Syntax Example Dim Product1, RtnString Product1 = "Financial Management" ' Define string RtnString = Left(Product1, 1) ' Returns "F" RtnString = Left(Product1, 9) ' Returns "Financial" RtnString = Left(Product1, 20) ' Returns "Financial Management"

Right Function
Returns a string containing a specified number of characters from the right side of a string. A Right function contains two required parts: Use String to return the requested values. Use Length (numeric value) to determine the number of characters to return. Syntax Right(String,Length) Example

Dim Product1, RtnString Product1 = "Financial Management" ' Define string. RtnString = Right(Product1, 1) ' Returns "t". RtnString = Right(Product1, 10) ' Returns "Management". RtnString = Right(Product1, 20) ' Returns "Financial Management".

a r O

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

1-27

Module 1 Financial Management Rules Basics Lesson 1 Reviewing Rules Syntax

Summary
In this lesson, you should have learned to: Explain the purpose of rules in Financial Management Describe objects and functions in expressions Create rules expressions Identify Financial Management rule types Distinguish between Sub procedures Add comments and line breaks Create conditional statements and compare strings

a r O
1-28

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

L E S S O N

2
2

Reducing Maintenance with Variables

Objectives
At the end of this lesson, you should be able to: Create variables and constants Set up variables header sections for the Point of View Set up variables header sections for custom dimensions, intercompany partner (ICP) dimensions, and global accounts Set up a variables header section for conditional triggers

a r O

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Module 1 Financial Management Rules Basics Lesson 2 Reducing Maintenance with Variables

About VB Script Variables


Variables temporarily store values when your script is running. Variables simplify rules scripts. Variables improve rules performance.
Dim vCurPeriod, vCurYear vCurPeriod=HS.Period.Number vCurYear=HS.Year.Member

Copyright 2008, Oracle. All rights reserved.

About VB Script Variables

Variables are placeholders that temporarily store values when the rules script is being executed. You can change the value of variables as many times as needed during execution. Variables simplify your script by letting you give short, descriptive names to data used in your rules. For example, pov_entity instead of HS.Entity.Member Variables improve performance because you can retrieve application data once and then reuse the data throughout a procedure. For example, you could retrieve the year total for the Sales account from your Financial Management application and store it in a variable. You can then use the variable in a series of calculations in your procedure, instead of retrieving the value from the application each time.

a r O
2-2

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

Module 1 Financial Management Rules Basics Lesson 2 Reducing Maintenance with Variables

Creating Variables and Assigning Values


Declare variables explicitly using Dim statements Create variables on the fly Enclose values in quotation marks to enter a literal text string
vAcc1=A#NetSales vSalaryRate=300 pov_entity=HS.Entity.Member

You can concatenate variables with literal text strings


HS.EXP "A#RetainedIncome=A#Profit" &vCustomTops& ".I#[ICP None]" HS.EXP "A#SalaryExpense=A#Headcount *" &vSalaryRate

Copyright 2008, Oracle. All rights reserved.

Creating Variables and Assigning Values

You can create variables explicitly using one or more Dim statements at the start of a subroutine. This method, called declaring the variables, enables you to look in a single place in a procedure when you want to reuse variables and need to remember their names. You can also create variables on the fly. However, they are scattered throughout the procedure. This method makes it difficult to check variable names when you want to reuse them. Dim Statement Syntax: Dim VariableName

a r O

For example, Dim vAcc1

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

2-3

Module 1 Financial Management Rules Basics Lesson 2 Reducing Maintenance with Variables Variable name guidelines: Must begin with an alphabetic character Cannot contain an embedded period Must not exceed 255 characters Must be unique in the scope in which it is declared You can create multiple variables with a single Dim statement by separating the variable names with commas. Example Dim vAcc1, vAcc2, vAcc3 You assign values to variables using an equal sign (=), with the variable name on the left and the value you want to assign the variable on the right. You can assign literal text strings, numeric values, return values of functions, or return values of expressions. If the variable does not exist, it is created on the fly. To assign a literal string value, you enclose the string in quotation marks. You do not need quotation marks to assign numeric values, function results, or expression results. vCustomTops=.C1#TopC1.C2#TopC3.C3#TopC3.C4#TopC4 vSalaryRate=300 pov_entity=HS.Entity.Member You can concatenate variables with literal text strings:

HS.EXP A#RetainedIncome=A#Profit"&vCustomTops&.I#[ICP None] HS.EXP A#SalaryExpense=A#Headcount *"&vSalaryRate

Notice that when the variable is at the end of the HS.Exp statement, it does not require a closing quotation mark.

a r O
2-4

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

Module 1 Financial Management Rules Basics Lesson 2 Reducing Maintenance with Variables

Variables and Data Types


VBScript assigns data types automatically. You can use conversion functions to force a data type.
Cbool CDate CDbl CInt CLng CSng CStr

Copyright 2008, Oracle. All rights reserved.

Variables and Data Types

In VBScript, you cannot specify in advance that a variable holds only a particular data type. Instead, you must use a variable known as a variant to store any data type. When you assign a value to the variable, VBScript automatically assigns the data type. Sometimes you may need to override the default data type. For example, you may need to store all values as integers. You can use conversion functions to explicitly set the data type:
Function CBool CDate CDbl Description

ra

e l c

Converts nonzero values to TRUE and zero values to FALSE. Converts an expression to a Date value. Converts an expression to a Double value (a 64-bit floating point number).

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

2-5

Module 1 Financial Management Rules Basics Lesson 2 Reducing Maintenance with Variables
Function CInt Description Converts an expression to an Integer value. If the fractional part of the expression is .5, CInt rounds the value to the nearest even number. For example, 3.5 is rounded to 4, and 6.5 to 6. The value of integer data can range from -32,768 to 32,767. Converts an expression to a Long value (an integer that can store a value from -2,147,483,648 to 2,147,483,647). Converts an expression to a Single value (a 32-bit floating point number). Converts an expression to a String value.

CLng CSng CStr

This example converts the result of the calculation to an integer and stores it in the variable vGM_Pct: vGM_Pct=CInt(vMargin/vNetSales*100)

a r O
2-6

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

Module 1 Financial Management Rules Basics Lesson 2 Reducing Maintenance with Variables

Variables and Constants


You declare constants at the beginning of rules files. They are available to all procedures at all times. After you assign a value to a constant, you cannot change it. You can use constants anywhere in your code in place of actual values, just as you use variables.
const ALL_NONE = ".I#[ICP None].C1#[None].C2#[None].C3#[None]" const ALL_TOPS = ".I#[ICP Top].C1#TopC1.C2#TopC2.C3#TopC3"

Copyright 2008, Oracle. All rights reserved.

Variables and Constants

Variables can be used only in the Sub procedure in which they are created. Constants are similar to variables, but with these differences: You can use constants in all Sub procedures within the script. After you define a constant (that is, after it has been assigned a value), you cannot change it. You can declare constants anywhere in the script file. If constants are declared at the beginning of the file, outside of any procedure, they are available to all procedures at all times. If constants are declared within a procedure, they are available only for that procedure.

a r O

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

2-7

Module 1 Financial Management Rules Basics Lesson 2 Reducing Maintenance with Variables You can use constants to store application information that you use frequently but that does not change. For example, you can create constants to store member names that are used frequently within account expressions. By using a short constant name in place of a long string of member names, you reduce the likelihood of errors. In Financial Management rules, you typically use constants to store information that does not vary with the Point of View settings for which the rules are run. Unlike variables, you must explicitly declare constants. They cannot be created on the fly. Syntax const Name=Value where Name is the name of the constant and Value is the value of the constant. The rules for naming constants are the same as for variables. This example creates a constant named AVE and assigns it a string as a value: Example const AVE=.A#AverageRate

A naming convention for constants is to use uppercase for names and underscores as separators, as in this example: const PRIOR_YEAR_RATE=75

You cannot use functions to assign values to constants. This statement returns an error: const CURRENT_ENTITY=HS.Entity.Member

a r O
2-8

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

Module 1 Financial Management Rules Basics Lesson 2 Reducing Maintenance with Variables

Creating Header Sections for Variables and Constants


These are some typical types of information stored in header section variables: The current POV members for the POV dimensions
pov_entity = HS.Entity.Member pov_scenario = HS.Scenario.Member pov_value = HS.Value.Member

Top and [None] members for custom and ICP dimensions; global accounts
ALL_NONE = ".I#[ICP None].C1#[None].C2#[None].C3#[None].C4#[None]" ALL_TOPS = ".I#[ICP Top].C1#TopC1.C2#TopC2.C3#TopC3.C4#TopC4"

Triggers for conditional statements


vIs_Trans = HS.Value.IsTransCur vIs_base = HS.Entity.IsBase("","")

'This yields a True or False 'This yields a True or False

Copyright 2008, Oracle. All rights reserved.

Creating Header Sections for Variables and Constants


It is a useful practice to create a standard header section in your Sub procedures with variables for frequently used information for your application. For application information that does not changed based on the Point of View, you can create a constants header section at the beginning of the rules file. These are some common types of information to include in a header section: Current Point of View members for page dimensions

Top and None members for custom and ICP dimensions Global account members

a r O

Conditional statement triggers

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

2-9

Module 1 Financial Management Rules Basics Lesson 2 Reducing Maintenance with Variables

Point of View Variables


Information about the current Point of View members for the Entity, Scenario, Year, and Value dimensions is typically used throughout a Sub procedure. Instead of repeatedly retrieving this information from the application, you can retrieve it once at the beginning of the procedure and store it in a variable. You can then use the value stored in the variable when a rule requires Point of View information. You retrieve the Point of View using the Member function. For example, HS.Entity.Member retrieves the current Entity POV member. Because the values change based on the current Point of View, you should use variables rather than constants.
TIP

For the variable for the current period, you can use HS.Period.Number instead of HS.Period.Member. Because the fiscal year can start on different months in different applications, if you use period numbers rather than member names, it is easier to reuse your rules in more than one application.

Top and None Members for Custom and ICP Dimensions

Custom and ICP dimensions in account expressions often need to be set to the top member or the [None] member. This can result in a long expression that is difficult both to type and to read. Example

HS.EXP A#RetainedIncome=A#Profit".I#[ICP Top].C1#TopC1.C2#TopC2& _ .C3#TopC3.C4#TopC4" To simplify your code, you can store the text string for custom and ICP members in a variable or constant, as in this example: const All_TOPS=.I#[ICP Top].C1#TopC1.C2#TopC2.C3#TopC3.C4#TopC4" You can then use the constant or variable in the account expression in place of the string: HS.EXP A#RetainedIncome=A#Profit" &All_TOPS

Because the custom and top member names do not change when the Point of View changes, you can use constants instead of variables.

a r O
2-10

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

Module 1 Financial Management Rules Basics Lesson 2 Reducing Maintenance with Variables

Global Accounts
You frequently need to refer to global accounts in your rules, such as the accounts used to store exchange rates or head count. You can create variables or constants for these accounts and then use them throughout your file. For example: vHead=.A#HeadCount vEfx=.A#EndingRate Because the global member names do not change when the Point of View changes, you can use constants instead of variables.

Conditional Statement Triggers


Financial Management provides a number of functions that return a value of true or false. You can use these functions as tests in conditional statements. For example, before executing a rule, you might test whether it is true or false that the current year is the first year in the application or that the current entity is a base entity. To make your rules file more efficient, you can perform the test once and store the result in a variable in your header section. For example: vIsBase = HS.Entity.IsBase("","")

You can then use the variable as needed in conditional statements. Because they are Boolean values, a value of True is assumed as the test. If vIsBase Then HS.EXP A#Sales=A#UnitsSold * A#Price End If

You can use the Not keyword to test for a false condition. This statement executes only if the entity is not a base member: If Not vIsBase Then HS.EXP A#Sales=A#UnitsSold * A#Price End If

For clarity in your code, you can specify True or False as the condition: If vIsBase=True Then HS.EXP A#Sales=A#UnitsSold * A#Price End If

a r O

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

2-11

Module 1 Financial Management Rules Basics Lesson 2 Reducing Maintenance with Variables These functions are frequently used as test for conditional statements.
Function IsBase IsCalculated IsChild IsConsolidated IsDescendant IsFirst Description Determines if the current member or a specified member is a base member of the application or of the specified parent. Determines if the current Account dimension member or a specified account member is a calculated account. Determines if the current member or a specified member is a child of the specified parent. Determines if the current Account dimension member or a specified account member is a consolidated account. Determines if the current member or a specified member is a descendant of the specified parent. Determines if the current period or year is the first period or year of the application. The default frequency of the current scenario is used to determine if the current period or year is the first period or year of the application. Determines if the current Account or Entity dimension member or a specified account or entity member is an intercompany partner (ICP). Determines if the current period or year is the last period or year of the application. The default frequency of the current scenario is used to determine if the current period or year is the last period or year of the application.

IsICP IsLast

IsTransCur IsTransCurAdj

Because the results returned by these functions can change based on the Point of View, you must use variables rather than constants.

a r O
2-12

e l c

e l c a r O ly & On l a e n r s e t U n I

Determines if the current Value dimension member is a translated currency member. Determines if the current Value dimension member is a translated currency Adj member..

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

Module 1 Financial Management Rules Basics Lesson 2 Reducing Maintenance with Variables

Summary
In this lesson, you should have learned to: Create variables and constants Set up variables header sections for the Point of View Set up variables header sections for custom dimensions, ICP dimensions, and global accounts Set up a variables header section for conditional triggers

a r O

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

2-13

Module 1 Financial Management Rules Basics Lesson 2 Reducing Maintenance with Variables

a r O
2-14

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

L E S S O N

3
3

Managing the Scope of Rules

Objectives
At the end of this lesson, you should be able to: Describe the effect of the subcube structure on Financial Management rules Manage the scope of rules with the Account, ICP, and custom dimensions Manage the scope of rules with the Value dimension Work with total members in the Value dimension

a r O

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Module 1 Financial Management Rules Basics Lesson 3 Managing the Scope of Rules

Subcubes and Data Retrieval


Accounts
Gross Sales Dis counts Returns 166 131 73 267 182 149 150 116 143 120 145 211

Period
Jan Feb Mar

Products
Diet Cola Root Beer Cream Soda Fruit Soda

267 Gross Sales of Fruit Soda in Jan

Copyright 2008, Oracle. All rights reserved.

Subcubes and Data Retrieval

An understanding of Financial Management subcubes is helpful for writing efficient rules. When processing rules or displaying data, Financial Management retrieves data from the Financial Management database in blocks called subcubes, rather than in records or rows. You can think of a subcube as a grid or spreadsheet with the dimension members on the rows and columns. Data is stored at the cells formed by the intersection of the members of the different dimension members in the subcube. All aggregations and calculations are performed on data in subcubes retrieved into RAM on the application server. The slide example shows a simple subcube with only three dimensions, Accounts (3 members), Products (4 members), and Periods (3 members). The subcube has a cell for each unique combination or intersection of members from the three dimensions, to create 36 cells for storing data.

a r O
3-2

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

Module 1 Financial Management Rules Basics Lesson 3 Managing the Scope of Rules

Financial Management Subcubes


California, Actual, 2006

Entity Currency

Parent Currency

Proportion

Copyright 2008, Oracle. All rights reserved.

Financial Management Subcubes

The number of subcubes in a Financial Management database is determined by the number of members in the Entity, Scenario, and Year dimensions. For each unique combination of members from these dimensions, there are three subcubes: one for local or (entity) currency Value dimension members, one for parent (translated) currency Value dimension members, and one for the proportion or contribution Value dimension members. The Entity, Scenario, Year, and Value dimensions are referred to as page dimensions. For example, for the combination of members represented by California (entity), Actual (scenario), 2006 (year), there are three subcubes: California ->2006 -> Actual -> Local currency members California ->2006 -> Actual -> Parent currency members California ->2006 -> Actual -> Proportion members

a r O

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

3-3

Module 1 Financial Management Rules Basics Lesson 3 Managing the Scope of Rules

Subcube Dimensions
California, Actual, 2006, Entity Currency

Account NetSales GrossSales Discount Returns

ICP [ICP None] [ICP None] [ICP None] [ICP None]

C1 [None] [None] [None] [None]

C2 Wood Wood Wood Wood

C3 Retail Retail Retail Retail

C4 [None] [None] [None] [None]

View Periodic Periodic Periodic Periodic

Period April April April April 300 350 25 25

Each subcube contains all members of the subcube dimensions.

Copyright 2008, Oracle. All rights reserved.

Subcube Dimensions

Each subcube always includes all members of the Account, custom, ICP, Period, and View dimensions. These dimensions are referred to as the subcube dimensions. Each cell in a subcube represents an intersection of the page dimension members for the subcube with a unique set of subcube dimension members. Subcube data is retrieved in an all-or-nothing manner. If a data grid, data form, or rule requests data from a cell in a subcube, Financial Management retrieves the entire subcube into memory. For example, a data grid or rule requests the value in the cell for Calfornia -> Budget -> 2006 -> Entity Currency -> Cash -> OpeningBalance -> ICP None -> Periodic -> Feb. Financial Management loads the entire California -> Budget -> 2006 -> Entity Currency subcube into memory. It then retrieves the value from the Cash -> OpeningBalance -> ICP None -> Periodic -> Feb cell from this subcube.

a r O
3-4

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

Module 1 Financial Management Rules Basics Lesson 3 Managing the Scope of Rules

Subcubes and Performance


Aggregations and calculations are most efficient when all members needed are preloaded in RAM. The subcube structure is designed to preload the members most likely to be needed for calculation and aggregations.
Jan Net Sales Products Sales Hardware Software Products Returns Hardware Software 240 300 100 200 60 25 35 Feb 360 400 200 200 60 25 35 Mar 310 350 150 200 40 20 20 Q1 910 1050 450 600 160 70 90 Aggregations:
Hardware & Software to Products S ales-Products & Returns-Products to Net Sales Net Sales Jan, Feb, Mar to Q1

Copyright 2008, Oracle. All rights reserved.

Subcubes and Performance

The Financial Management subcube structure is designed for highly efficient processing of data. Processing data in RAM is much more efficient than retrieving it from disk; therefore performance is improved by reducing the number of times data needs to be read from the database on disk. The Financial Management subcube structure is designed to anticipate the data needed for aggregations and calculations and preload it into RAM. Because many dependencies typically exist between data for members of the Account and the custom dimensions, a change to data in one Account/custom dimension combination is likely to require recalculation of data in other Account/custom dimension member combinations. If all Account and custom members in the subcube are loaded into RAM, this increases the likelihood that all data needed for aggregations and calculations will be available.

a r O

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

3-5

Module 1 Financial Management Rules Basics Lesson 3 Managing the Scope of Rules Similar considerations hold for data in the Period dimension. The current periods values frequently depend on prior period values. If you include data for all periods, you reduce the number of times that the data must be read from disk to calculate data for periods. Period members are part of the subcube in RAM. Therefore, when you run a rule for the current period in the Point of View, Financial Management calculates values for all prior periods and creates derived values for future periods with minimal performance impact.

a r O
3-6

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

Module 1 Financial Management Rules Basics Lesson 3 Managing the Scope of Rules

Subcubes and Rules

If HS.Entity.Member=California and HS.Scenario.Member=Budget Then HS.Exp A#Returns.C2#Wood.C3#Retail=A#GrossSales.C2#Wood.C3#Retail *1.05 End If

California Budget 2006 <Entity Currency>


Account NetSales GrossSales Discount Returns ICP [ICP None] [ICP None] [ICP None] [ICP None] C1 [None] [None] [None] [None] C2 Wood Wood Wood Wood C3 Retail Retail Retail Retail C4 [None] [None] [None] [None] View Periodic Periodic Periodic Periodic Period April April April April 307.5 350 25 17.5

Copyright 2008, Oracle. All rights reserved.

Subcubes and Rules

The Financial Management subcube structure affects how rules work in Financial Management. The effect of the subcube is particularly clear in how you assign values to accounts using HS.Exp.

The Left Side of HS.Exp

The subcube to which a rule writes data is determined by the currently selected page dimension members in the Point of View. You cannot specify the subcube in the rule itself. This is why the left-side or destination side value of the HS.Exp function can contain only Account, custom, ICP, and View dimension members. You can specify the subcubes for a rule indirectly, however, by using conditional statements. For the example on the slide, the HS.Exp function is executed only if the current Point of View includes California and Budget members.

a r O

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

3-7

Module 1 Financial Management Rules Basics Lesson 3 Managing the Scope of Rules Bulk Assignment of Values The Financial Management subcube structure explains why HS.Exp permits bulk assignment of values across the Account, custom, and ICP dimensions, but not across the Entity, Scenario, or Year dimension. For example, you can use A#ALL to assign a value to all accounts in the current subcube. Because all members of the Account, custom, and ICP dimensions for the current subcube are in RAM, you can assign values in bulk without degrading performance. Bulk assignment of values across entities, scenarios, or years is not permitted. Page dimension members have separate subcubes. If you assign values to multiple members, you must load many subcubes from disk into memory, thereby degrading performance. For example, in an application with 1,000 entities, if you assign E#ALL in an HS.Exp expression, 1,000 subcubes would have to be opened.

a r O
3-8

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

Module 1 Financial Management Rules Basics Lesson 3 Managing the Scope of Rules

Page Dimensions and HS.Exp


If HS.Scenario.Member=Variance Then HS.Exp A#All = S#Budget - S#Actual End If
Variance = Budget Ac tual

Copyright 2008, Oracle. All rights reserved.

Page Dimensions and HS.Exp

Data for the current subcube in the Point of View often depends on data in other subcubes. For example, the current year opening balances could be derived from the prior year closing balances, and data for different years are stored in separate subcubes. For this reason, you can specify page dimension members on the right side of the HS.Exp function, to retrieve values from other subcubes as needed. For the example on the slide, the HS.Exp function is executed if Variance is the current scenario in the Point of View. Account values in the Variance scenario are derived from the values in the Actual and Budget scenarios. Scenario values are stored in separate subcubes. Therefore, to calculate the values for the Variance scenario, you must also load the Actual and Budget scenario subcubes into RAM.

a r O

If the Account and custom dimensions have a large number of members, you can affect rule performance if you open additional subcubes. You need to take this into consideration when writing rules.

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

3-9

Module 1 Financial Management Rules Basics Lesson 3 Managing the Scope of Rules You should also take the page dimensions into consideration when you run rules. For example, you could have a data grid with 20 entities in the row and 3 scenarios in the columns. If you want to calculate all rows and columns in the grid, you must open and calculate 60 subcubes. Performance is best when the subcube dimensions are on the rows and columns and the page dimensions are on the Point of View.

a r O
3-10

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

Module 1 Financial Management Rules Basics Lesson 3 Managing the Scope of Rules

Managing the Scope of Expressions


You should understand how HS.Exp behaves when the account dimension, the ICP dimension, or a custom dimension:
is omitted from both sides of the equal sign is specified on the left side of the equal sign only is specified on the right of the equal sign only

HS.Exp A#ALL=100

100 100

100

100 100 100 100 100 100 100 100 100

Copyright 2008, Oracle. All rights reserved.

Managing the Scope of Rules

HS.Exp is a powerful function that enables you to assign values to thousands of Account, custom, and ICP dimension members with a single expression. When you assign values, using the HS.Exp function, you specify Account, ICP, and custom dimension dimensions on the left and right sides of the equal sign. How you specify the dimensions on each side of the equals sign determines the range of members to which values are assigned.

a r O

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

3-11

Module 1 Financial Management Rules Basics Lesson 3 Managing the Scope of Rules

Omitting Dimensions
HS.Exp A#GrossSales = A#GrossSales.P#Prior * 1.1

A#GrossSales Custom2
Product 1 Product 2 Product 3

A#GrossSales.C2#P roduct 2 = Custom2


Product 1 Product 2 Product 3

Copyright 2008, Oracle. All rights reserved.

Omitting Dimensions

If you omit the Account dimension, ICP dimensions, or a custom dimension from both sides of the equal side of the HS.Exp function, members of the omitted source dimension are mapped to the corresponding members in the destination dimension. If a custom member in the source is not valid for the destination account, that custom member is skipped. For the example on the slide, because the Custom2 dimension is omitted from both sides of the equal sign, members of the Custom2 dimension for February, GrossSales (source), are mapped to the corresponding Custom2 dimension members in March, GrossSales (destination). In the following example, the Account dimension is omitted. The source is the ClosingBalance member of the Custom1 dimension of the prior period, and the destination is the OpeningBalance member of the Custom1 dimension for the current period. Because the Account dimension is omitted from both sides of the equal sign, the accounts for the source are mapped to the corresponding accounts for the destination.

a r O
3-12

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

HS.Exp C1#OpeningBalance=C1#ClosingBalance.P#Prior Hyperion Financial Management 9.3.1: Create Rules

Module 1 Financial Management Rules Basics Lesson 3 Managing the Scope of Rules

Specifying the Destination Dimensions


HS.Exp A#GrossSales.C2#Steel = A#GrossSales.P#Prior * 1.1

A#GrossSales Custom
Product 1 Product 2 Product 3

= A# GrossSales.C2#Product 2
Custom
Product 1 Product 2 Product 3

Copyright 2008, Oracle. All rights reserved.

Specifying the Destination Dimensions

If you specify a member from the Account, ICP, or custom dimension on the destination side or left side of HS.Exp, the value of the corresponding member for that dimension in the source or right side is retrieved. You need not specify the source dimension. For the example on the slide, the Steel member from the Custom2 dimension is specified as the destination of HS.Exp. The value for Steel is retrieved from the source, even though no member for Custom2 is specified as the source.

a r O

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

3-13

Module 1 Financial Management Rules Basics Lesson 3 Managing the Scope of Rules

Specifying Source Dimensions


HS.Exp A#GrossSales=A#GrossSales.C2#Steel.P#Prior*1.1

A#GrossSa les Custom


Product 1 Product 2 Product 3

= A#GrossSales.P#Prior
Custom
Product 1 Product 2 Product 3

Data explos ion!

Copyright 2008, Oracle. All rights reserved.

Specifying Source Dimensions

If you specify a member from the Account, ICP, or custom dimension source side (right side) of HS.Exp expression, the member value is copied to all valid members of that dimension in the destination. For the example on the slide, the Steel member from the Custom2 dimension is specified as the source. The value for Steel is copied to the cells for all Custom2 members of the destination account. You should be extremely cautious when specifying only source dimensions. Because the value for the dimension is copied to all valid members for that dimension in the destination, you can easily fill the database with incorrect values or with zero values, causing a data explosion.

a r O
3-14

For the example on the slide, assume that Custom2 has 1,000 members, Custom3 has 200 members, and both dimensions are valid for the GrossSales account. The value for Steel would be copied to all valid intersections of Custom2 and Custom3, which would fill 200,000 cells with data. Hyperion Financial Management 9.3.1: Create Rules

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Module 1 Financial Management Rules Basics Lesson 3 Managing the Scope of Rules

Mismatched Custom Dimensions (Example 1)


HS.Exp A#RetainedInc.C1#Movement=A#Profit.C1#[None].C2#TopC2.C3#TopC3.C4#[None]

A#RetainedInc
C1:Movement C2: [None] C3: [None] C4: [None]

A#Profit

C1: None

C2: Top Member Member Member

C3: Top Member Member Member

C4: None

Custom1 is valid for RetainedInc. Custom2 and Custom3 are valid for Profit.

Copyright 2008, Oracle. All rights reserved.

Mismatched Custom Dimensions (Example 1)

Custom dimension members valid for the source account of an HS.Exp expression frequently do not match the members valid for the destination account. In this case, you cannot rely on the HS.Exp function to automatically map source dimension members to custom dimension members. You must analyze the valid custom dimension members to determine which destination cells should receive values from the source. Typically, the source account stores more custom detail than the destination account. You must copy summarized values from the source to the destination. For the example on the slide, Profit is an income statement account that tracks profit by product (Custom2) and market (Custom3). Custom1 and Custom4 are not valid for the Profit account. RetainedInc is a balance sheet account that stores movement information in the Custom1 dimension, but for which the other custom dimensions are not valid.

a r O

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

3-15

Module 1 Financial Management Rules Basics Lesson 3 Managing the Scope of Rules For the Profit account: The top-level members are selected for the Custom2 and Custom3 dimensions to arrive at a single rolled-up value for Profit for all products and markets. Custom1 and Custom4 are set to None since they are not valid for the Profit account. For the RetainedInc account: The Movement member is selected for Custom1. Because Custom2, Custom3, and Custom4 are not valid for RetainedInc, the None member is automatically selected for these dimensions and they can be omitted from the destination (left) side of the equal sign.

a r O
3-16

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

Module 1 Financial Management Rules Basics Lesson 3 Managing the Scope of Rules

Mismatched Custom Dimensions (Example 2)


HS. Exp A#Packaging=A#Sales.C3#TotalMarkets.I#[ICP Top] * .05

A#Packaging
C3: None C3: None C3: None C2: Prod1 C2: Prod2 C2: Prod3

A#Sales

= = =

C2: Prod1 C2: Prod2 C2: Prod3

C3: TotalMarkets C3: TotalMarkets C3: TotalMarkets

Custom 2 is valid for Packaging. Custom2 and Custom3 are valid for Sales. Sales is an interc ompany account, Packaging is not.

Copyright 2008, Oracle. All rights reserved.

Mismatched Custom Dimensions (Example 2)

This example shows a partial overlap of valid custom dimension members for the source and destination accounts. Sales are budgeted by product and market. Packaging is budgeted by product as a percentage of the total sales. The Products hierarchy of Custom2 and the Markets hierarchy of Custom3 are valid for the Sales account, but only the Products hierarchy is valid for the Packaging account. Further, Sales is an intercompany account, but Packaging is not. For the Sales account (source):

Custom3 is set to the TotalMarkets member, which retrieves the total for all markets for each product. The ICP dimension is set to ICP Top, to roll up all ICP transactions.

a r O

Custom2 is omitted, so that the Product members for Custom2 for Sales is mapped to the corresponding members for Packaging.

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

3-17

Module 1 Financial Management Rules Basics Lesson 3 Managing the Scope of Rules For the Packaging account (destination): Custom2 is omitted, so that the Product members for Custom2 for Sales is mapped to the corresponding members for Packaging. The ICP dimension is omitted. Because Packaging is not an intercompany account, the ICP None member is selected automatically. Custom1 and Custom3 are omitted from both sides of the equal sign because they are invalid for both accounts. For clarity in your expressions, you can include all dimensions explicitly on both sides of the expression. The following expression is equivalent to the expression in the slide example: HS.Exp A#Packaging.C1#[None].C3#[None].C4#[None].I#[ICP None]=& _ A#Sales.C1#[None].C3#TotalMarkets.C4#[None].I#[ICP Top]

a r O
3-18

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

Module 1 Financial Management Rules Basics Lesson 3 Managing the Scope of Rules

Executing Rules with the Value Dimension


The Value Dimension
[Contribution Total] [Contribution]
Sub Calculate Sub Consolidate

[Contribution Adjs] [Elimination]

Sub Calculate Sub Calculate Sub Consolidate

[Proportion] [Parent Total] [Parent] <Parent Curr Total>

[Parent Adjs]

Sub Calculate

Sub Calculate Sub Translate

<Parent Currency>

<Parent Curr Adjs>

Sub Calculate

<Entity Curr Total>


Sub Calculate

<Entity Currency>
Data stored

<Entity Curr Adjs>

Sub Calculate

Calculated on the fly data not stored

Copyright 2008, Oracle. All rights reserved.

Executing Rules with the Value Dimension

The data input to the Entity Currency member of the Value dimension is potentially transformed several times before it is ready for consolidation to a parent entity: If journal entries are entered for the data, the journal adjustments are applied. If it uses a different currency than its parent, the data is translated to the parents currency. If the parent ownership of the entity is less than 100%, the data is adjusted to reflect percent ownership. If the data is from an intercompany transaction with another entity, it may need to be eliminated.

a r O

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

3-19

Module 1 Financial Management Rules Basics Lesson 3 Managing the Scope of Rules The calculations required for these transformations are accomplished by Financial Management rules.The result of each of these transformations is stored in a separate Value dimension member. Of the 14 Value dimension members, 8 members store data.The slide example shows the rules procedures that are executed for each member. Notice that the Sub Calculate procedure is executed for the 8 Value dimension members that store data. The members of the Value dimension for which rules are not executed are on-the-fly aggregations of Value dimension members below them. Data is not stored for these members. Rules can retrieve data from these Value dimension members, but they cannot write to them.

a r O
3-20

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

Module 1 Financial Management Rules Basics Lesson 3 Managing the Scope of Rules

Sub Calculate and the Value Dimension


For each rule in the Sub Calculate procedure, determine the Value dimension members to which it applies. Use conditional statements to create sections in your Sub Calculate procedure within which to place the rules for specific Value dimension members.
This section contains rules for the Entity Currency and Entity Curr Adjs members If HS.Value.Member="<Entity Currency>" or HS.Value.Member="<Entity Curr Adjs>" Then HS.Exp "A#Sales=A#UnitsSold * A#Price" HS.Exp "A#Taxes=A#IncomeBeforeTaxes.C1#TopC1.C2#TopC2.C3#Top3.I#[ICP Top]& _ * A#TaxRate /100" End if

Copyright 2008, Oracle. All rights reserved.

Sub Calculate and the Value Dimension

Because Financial Management runs the Sub Calculate procedure for the eight Value dimension members that store data, Sub Calculate potentially runs eight times for each Entity-Year-Scenario combination that you calculate or consolidate. If you do not manage the scope of the Value dimension in your rules, these problems can arise: Degraded performanceRules required by only one Value dimension member are executed for all eight Value dimension members. Incorrect resultsRules might be executed for Value dimension members for which they were not designed, leading to incorrect results. For example, a rule that calculates translation adjustments should not be executed for the Entity Currency member.

a r O

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

3-21

Module 1 Financial Management Rules Basics Lesson 3 Managing the Scope of Rules For each rule, you should determine the Value dimension members that it applies to. You should then place it within a conditional statement so that it is executed only for the correct Value dimension members. Most rules in the Sub Calculate procedure need to be executed only for the Entity Currency and Entity Curr Adjs members. The remaining Value dimension members are calculated by the Sub Translate and Sub Consolidate procedures. A good practice is to use an If...Then statement to create a section in which to place all rules for Entity Currency and Entity Currency Adjs. You can use additional If...Then statements to create sections for rules for other Value dimension members as needed.

a r O
3-22

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

Module 1 Financial Management Rules Basics Lesson 3 Managing the Scope of Rules

Working with Total Members


Rule executes for Entity Currency, but you need to use Entity Curr Total in your calculation. <Entity Curr Total> <Entity Currency> <Entity Curr Adjs>

If pov_value=<Entity Currency>" Then HS.Exp "A#SalesTax=A#Sale.V#<E ntity Curr Total> * .06" End if

Copyright 2008, Oracle. All rights reserved.

Working with Total Members

The Entity Curr Total, Parent Curr Total, and Contribution Total members of the Value dimension contain the adjusted totals for the Entity Currency, Parent Currency, and Proportion members, respectively. You often need to use adjusted totals in calculations. Because rules are not executed at the total members, you must override the default source (right) Value dimension member side of the equal sign of HS.Exp to retrieve the values from these members. For the example on the slide, if no Value dimension member is specified as the source, the value for Entity Currency, the current POV member when the rule is executed, is retrieved by default. Because SalesTax must be calculated based on the adjusted total for Sales, Entity Curr Total is specified for the source Value dimension, overriding the default.

a r O

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

3-23

Module 1 Financial Management Rules Basics Lesson 3 Managing the Scope of Rules If you want to write rules that use the correct Value dimension total member for whatever Point of View is selected, you can create a variable whose value is set to a total member based on the current Point of View. You can then use the variable as needed in your rules. This example sets the value of the variable vTotal to the correct total member based on the current Point of View for the Value dimension: If pov_value = "<Entity Currency>" Then vTotal = ".V#<Entity Curr Total>" ElseIf HS.Value.IsTransCur Then vTotal = V# &HS.Value.Currency& " Total" ElseIf pov_value = "[Proportion]" Then vTotal = ".V#[Contribution Total]" End If You can use the vTotal variable in any rule that needs to retrieve a value from a total member. HS.Exp "A#Acc1=A#Acc2 "& vTotal
NOTE

When referring to total members in a rule, you should check the order in which the rules are calculated. In the preceding example, because Acc1 uses the total calculated for Acc2, any rule that calculates Acc2 must precede the rule for Acc1. Otherwise, the total for Acc2 might not be valid.

a r O
3-24

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

Module 1 Financial Management Rules Basics Lesson 3 Managing the Scope of Rules

Summary
In this lesson, you should have learned to: Describe the effect of the subcube structure on Financial Management rules Manage the scope of rules with the Account, ICP, and custom dimensions Manage the scope of rules with the Value dimension Work with total members in the Value dimension

a r O

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

3-25

Module 1 Financial Management Rules Basics Lesson 3 Managing the Scope of Rules

a r O
3-26

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

L E S S O N

4
4

Creating Rules for Dynamic Accounts

Objectives
At the end of this lesson, you should be able to: Describe dynamic accounts Describe the Sub Dynamic procedure Create rules for dynamic accounts

a r O

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Module 1 Financial Management Rules Basics Lesson 4 Creating Rules for Dynamic Accounts

Dynamic Account Types


Accounts that use the Dynamic account type have this behavior: Values are not stored; they are calculated as the data is requested. Parent totals for accounts, custom dimensions, and time periods are calculated dynamically, they are not aggregated from children. Period-to-date views calculate correctly

Copyright 2008, Oracle. All rights reserved.

Dynamic Account Types

Dynamic accounts are accounts whose values are dynamically calculated when the data is requested. Ratios and percentages are the most common type of dynamic calculations. Only base accounts can be dynamic. Dynamic accounts ignore the following account attributes: ISConsolidated ISCalculated EnableCustom1...4Aggr UsesLineItems

a r O
4-2

The IsConsolidated and EnableEnableCustom1...4Aggr attributes do not apply to dynamic accounts because dynamic accounts are recalculated at the parent level; they are not aggregated. The IsCalculated and UseLineItems attributes do not apply because data for dynamic accounts is calculated, not stored. Hyperion Financial Management 9.3.1: Create Rules

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Module 1 Financial Management Rules Basics Lesson 4 Creating Rules for Dynamic Accounts

Sub Dynamic Procedures


Dynamic rules are stored in a procedure called Sub Dynamic() in the rules file. Sub Dynamic() procedures are executed when you calculate or consolidate data.
Sub Dynamic( ) <All dynamic rules are displayed here.> End Sub

Copyright 2008, Oracle. All rights reserved.

Sub Dynamic Procedures


Syntax

You use Sub Dynamic procedures to create rules for dynamic accounts.

Sub ProcedureName() Type your Dynamic rule here End Sub Example

This example uses the account GM_PCT to store the results of the formula for GM divided by Sales and then multiplied by 100:

a r O

Sub Dynamic() HS.Dynamic "A#GM_PCT = A#GM / A#Sales * 100" End Sub

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

4-3

Module 1 Financial Management Rules Basics Lesson 4 Creating Rules for Dynamic Accounts

Creating Rules for Dynamic Accounts


You use the HS.Dynamic function to create rules for dynamic accounts. You can use HS.Dynamic only in Sub Dynamic procedures. HS.Dynamic is executed for the current Point of View for Entity, Scenario, and Year. You cannot use conditional statements with dynamic rules.
Sub Dynamic HS.Dynamic "A#GM_PCT=A#GM/A#Sales*100" End Sub

Copyright 2008, Oracle. All rights reserved.

Creating Rules for Dynamic Accounts

Dynamic account values are calculated on the fly as data is requested from Sub Dynamic procedures. You use the HS.Dynamic function within the procedures to create rules for dynamic accounts. Syntax

HS.Dynamic "DestPOV = Expression" Guidelines:

The right side of the equation (source) cannot reference the Scenario, Year, or Entity dimensions.

a r O
4-4

Only dynamic accounts and View dimension members are valid on the left side of the equation (destination). You cannot use dynamic accounts as the source.

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

Module 1 Financial Management Rules Basics Lesson 4 Creating Rules for Dynamic Accounts If you do not specify the View dimension as the destination, the calculation is executed for all views. If you specify the View dimension, the calculation is executed only for the specified view. You cannot use conditional statements within Sub Dynamic procedures. Statements in Sub Dynamic procedures are executed sequentially. The HS.Dynamic function can reference data only in the current subcube. If you want to reference data from a different subcube, you may need to create a "parking" account to store information from the other cube. For example, to reference a prior year's data in the formula, create a memorandum account to store last year's data in the current years subcube and reference the memorandum account in the dynamic calculation. The table lists the expected results for the GMPercent account, assuming the Product custom member is the parent of P1, P2 and P3. Notice that Product custom member is calculated by the formula; it is not aggregated from its children.
Custom1 Product P1 P2 P3 Sales 600 100 200 300 GM 140 10 40 90 GM% Dynamic Calc. 23.33% 10% 20% 30% Calculation from Formula 140 / 600 * 100 10 / 100 * 100 40 / 200 * 100 90 / 300 * 100

You can include the View dimension on the left side of the equal sign as the destination to limit the calculation to a specific view. In this example, the GMPercent calculation is executed only if you set the Point of View to periodic. Sub Dynamic HS.Dynamic "A#GMPercent.W#Periodic = A#GM / A#Sales * 100" End Sub

a r O

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

4-5

Module 1 Financial Management Rules Basics Lesson 4 Creating Rules for Dynamic Accounts

Functions Valid with HS.Dynamic


These functions can be embedded within HS.Dynamic: HS.View.PeriodNumber HS.Period.NumPerInGen HS.Period.Number

Copyright 2008, Oracle. All rights reserved.

Functions Valid with HS.Dynamic

Because HS.Dynamic expressions are dynamically calculated for summary time periods, you can create formulas for different views, such as quarter-to-date or half-year-to-date. You can use the following functions with HS.Dynamic to create calculations for views. HS.View.PeriodNumber Returns the period number within the view for the data being retrieved. It can be used only in dynamic rules. Syntax

HS.View.PeriodNumber

a r O
4-6

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

Module 1 Financial Management Rules Basics Lesson 4 Creating Rules for Dynamic Accounts Example This example shows possible values for different views:
J Periodic YTD QTD HYTD 1 1 1 1 F M Q1 1 1 2 3 2 3 2 3 1 1 1 1 A M J Q2 1 4 1 4 1 5 2 5 1 1 6 2 3 1 6 2 H1 1 1 1 1 J A S Q3 1 1 1 7 8 9 1 2 3 1 2 3 1 3 1 1 O 1 10 1 4 N 1 11 2 5 D 1 12 3 6 Q4 1 4 1 2 H2 1 2 2 1 Y 1 1 1 1

HS.Period.NumPerInGen Returns the number of periods within the generation for the period being processed. This function is used only in Dynamic rules. Syntax HS.Period.NumPerInGen Example If the current period is April, and April is the fourth generation within the calendar file (monthly generation), the number of periods in the generation is 12. If the current period is Q2, and Q2 is the third generation within the calendar file (quarterly generation), the number of periods in the generation is 4. Monthly generation: (Fourth generation) Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec The system returns 12 for the number of periods in this generation. Quarterly generation: (Third generation) Q1, Q2, Q3, Q4 The system returns 4 for the number of periods in this generation. Half-yearly generation: (Second generation) HY1, HY2 The system returns 2 for the number of periods in this generation. Yearly generation: (First generation) Year The system returns 1 for the number of periods in this generation.

a r O
Syntax

HS.Period.Number Returns the current period number.

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

HS.Period.Number Hyperion Financial Management 9.3.1: Create Rules 4-7

Module 1 Financial Management Rules Basics Lesson 4 Creating Rules for Dynamic Accounts

Summary
In this lesson, you should have learned to: Describe dynamic accounts Identify Sub Dynamic procedure Create rules for dynamic accounts

a r O
4-8

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

M O D U L E

2
4

Creating Procedures, Loops, and Arrays

Overview
In this module you learn how to create custom Sub and Function procedures. You learn to create rules using arrays and loops. Lessons in this module include: Creating Custom Procedures Creating Arrays and Loops

a r O

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

a r O

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

L E S S O N

5
5

Creating Custom Procedures

Objectives
At the end of this lesson, you should be able to: Create custom Sub procedures Create custom Function procedures Troubleshoot rules script with custom logging procedures Managing log files

a r O

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Module 2 Lesson 5 Creating Custom Procedures

Creating Procedures, Loops, and Arrays

Creating Custom Sub Procedures


Custom procedures provide these benefits: They make rules files easier to read. They simplify troubleshooting by separating script into logical units. They allow rules to be reused by multiple calling procedures
Sub OpeningBalance() ... ... End Sub Function ExpenseCalc() ... ... End Function

Copyright 2008, Oracle. All rights reserved.

Creating Custom Sub Procedures

In addition to using the eight predefined Financial Management Sub procedures, you can define custom Sub procedures. You can execute, or call, custom procedures from within the predefined Financial Management procedures or from another custom procedure. For example, at line 15 in the Sub Calculate procedure, you could call a custom procedure named Sub OpeningBalances. The Sub Calculate procedure stops executing and the statements in Sub OpeningBalances are executed. When the statements in Sub OpeningBalances finish executing, the Sub Calculate procedure resumes execution at line 16. Custom Sub procedures ease organization and maintenance of rules files. Instead of working with a single procedure that may contain hundreds of lines of script for different tasks, you can create multiple Sub procedures, each of which performs a single task. When you define a custom Sub procedure, you can specify one or more variables to receive values passed from the calling procedure. Hyperion Financial Management 9.3.1: Create Rules

a r O
5-2

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Module 2 Creating Procedures, Loops, and Arrays Lesson 5 Creating Custom Procedures Syntax Sub ProcedureName (Var1,Var2,Var3,...) ... ... End Sub Arguments ProcedureName The name of the procedure Var1,Var2, Var3,...) A list of variable names to receive values passed from the calling procedure

a r O

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

5-3

Module 2 Lesson 5 Creating Custom Procedures

Creating Procedures, Loops, and Arrays

Calling Custom Sub Procedures


Sub Calculate() ExpRate=500 call ExpenseCalc("A#Travel",ExpRate) ExpRate=20 call ExpenseCalc("A#Supplies",ExpRate) End Sub Sub ExpenseCalc(Acct,Rate) HS.Exp Acct &"= A#Headcount *"&Rate End Sub

Copyright 2008, Oracle. All rights reserved.

Calling Custom Sub Procedures

To call a Sub procedure, you use the call keyword followed by the Sub procedure name and parentheses, with values to be passed, if any, within the parentheses. Alternatively, you can omit the call keyword and simply use the Sub procedure name. If you omit the call keyword, the parentheses are optional. Using the call keyword, however, adds clarity to your script by showing explicitly that a Sub procedure is being called. You can pass values from the calling procedure to the custom Sub procedure. You can pass literal values or variables that exist in the calling procedure. If you are passing a literal text string, enclose it in quotation marks. If you are passing a numeric value or a variable, do not use quotation marks. The values passed from the calling procedure must correspond to variables defined in the Sub statement of the custom Sub procedure.

a r O
5-4

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

Module 2 Creating Procedures, Loops, and Arrays Lesson 5 Creating Custom Procedures For the example on the slide, the Sub ExpenseCalc procedure is called twice from the Sub Calculate procedure. The first time it is called, the literal text string A#Travel is passed to the Acct variable of Sub ExpenseCalc. The current value of ExpRate (500) is passed to the Rate variable of Sub ExpenseCalc. When Sub ExpenseCalc is called again, the literal text A#Supplies is passed to the Acct variable and 20, the current value of ExpRate, is passed to the Rate variable. When you pass a variable to a procedure, you can pass it by reference or by value: By referenceIf the called procedure changes the value of the variable, the value of the variable is changed in the calling procedure as well. By default, VBScript passes variables by reference. By valueIf the called procedure changes the value of the variable, the value of the variable is not changed in the calling procedure. You must enclose the variable in parentheses. By default, VBScript passes variables by reference. To pass variables by value, surround the variable with parentheses. In the following example, the Acct variable is passed by value and the Rate value is passed by reference: Sub ExpenseCalc((Acct),Rate)

a r O

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

5-5

Module 2 Lesson 5 Creating Custom Procedures

Creating Procedures, Loops, and Arrays

Creating Custom Function Procedures


Functions perform an operation and return the result of the operation to the calling procedure.
'Calculates the change between current period 'and opening balance Function Change(Acct) If UCase(HS.Account.AccountType(Acct))="ASSET" Then Change="(A#" &Acct& ".P#Last.Y#Prior-A#" &Acct&")" Else Change="(A#" &Acct& "-A#" &Acct& ".P#Last.Y#Prior)" End If End Function
This value is returned to the calling procedure.

Copyright 2008, Oracle. All rights reserved.

Creating Custom Function Procedures

Function procedures perform an operation and return the result of the operation to the calling procedure. As with Sub procedures, the calling procedure can pass values to the Function procedure. For example, the calling procedure might pass two text strings to the Function procedure. The Function procedure might then concatenate the two text strings and pass the concatenated string back to the calling procedure as a return value. When you define a custom Function procedure, you can specify one or more variables to receive values passed from the calling procedure. Within the function, you use the function name as a variable to store the return value.

a r O
5-6

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

Module 2 Creating Procedures, Loops, and Arrays Lesson 5 Creating Custom Procedures Function Function FunctionName (Var1,Var2, VarN,...) ... FunctionName=ReturnValue ... End Function Arguments FunctionName The name of the Function procedure Var1,Var2, VarN A list of variable names that receive values passed from the calling procedure ReturnValue The return value for the function (a literal value or an expression that returns a value.)

a r O

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

5-7

Module 2 Lesson 5 Creating Custom Procedures

Creating Procedures, Loops, and Arrays

Calling Custom Function Procedures


Sub Calculate() HS.EXP "A#Travel=" &HeadCountCalc(500) HS.EXP "A#Supplies="&HeadCountCalc(20) End Sub Function HeadCountCalc(Rate) HeadCountCalc=HS.GetCell("A#Headcount") * Rate End Function

Copyright 2008, Oracle. All rights reserved.

Calling Custom Function Procedures

To call a function, place the function name at the location in the script where you want to insert the return value. When passing values to the variables, use the same syntax as for Sub procedures.

a r O
5-8

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

Module 2 Creating Procedures, Loops, and Arrays Lesson 5 Creating Custom Procedures

Troubleshooting with Logging Procedures


You use a write to file procedure to create custom log files. You use custom log files to verify:
Execution time for a procedure Point of View for a procedure Calculations

Copyright 2008, Oracle. All rights reserved.

Troubleshooting with Logging Procedures

You can create custom logging procedures to troubleshoot rules scripts. A logging procedure writes a text-based log file that records information regarding the execution of the rules script. Typical information to include in a log file:

Start time and end time of each executed procedure (Helps determine which procedures have performance problems.) Point of View for which the procedure was executed

Values written to the database (Helps verify that calculations are correct.)

a r O

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

5-9

Module 2 Lesson 5 Creating Custom Procedures

Creating Procedures, Loops, and Arrays

Writing to Log Files


1

Sub WriteToFile(txtStringToWrite) Dim fso,f 3 Set fso=CreateObject("Scripting.FileSystemObject") 4 Set f=fso.OpenTextFile("c:\ruleslog.txt",8,True) 5 f.WriteLine txtStringToWrite & " " & Now() 6 f.Close End Sub
2

Copyright 2008, Oracle. All rights reserved.

Writing to Log Files

Several VBScript functions enable you to create text files and write information to them. You can use these functions with the VBScript File System and File objects. To write to log files:

These steps explain how to use functions to write to log files:

1. Use a Sub statement to create a logging procedure. Include a variable to receive a text string from a calling procedure. For the example on the slide, the Sub procedure is named WriteToFile and the variable is txtStringtoWrite. 2. Declare variables for a File System object and a File object. For the example on the slide, the variables fso and f are declared.

a r O
5-10

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

Module 2 Creating Procedures, Loops, and Arrays Lesson 5 Creating Custom Procedures 3. Create a File System object and assign it to the file system object variable. Use the Set statement with the CreateObject function to create a File System object. For the example on the slide, the set command assigns a File System object to the fso variable. 4. Use the OpenTextFile function to open an existing text file; alternatively, create the file if it does not exist. For the example on the slide, the file c:\ruleslog.txt is opened and assigned to the File object variable declared in step 2. 5. Write one or more lines of text to the file using the WriteLine function with the File object. For the example on the slide, the WriteLine function writes the value of the txtStringtoWrite variable, concatenated with the current system data and time. 6. Close the file using the Close function with the file object.
NOTE

The file location for the log file must be a server and directory to which the Financial Managment DCOM/ADMIN user has full modify access. This section describes the syntax for the functions used in the logging procedure. Close Closes a file Syntax object.Close Arguments Object A File object

CreateObject("Scripting.FileSystemObject") Creates a VBScript File System object Syntax Arguments Var

Set Var = CreateObject("Scripting.FileSystemObject")

a r O

A variable for the object

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

5-11

Module 2 Lesson 5 Creating Custom Procedures Now Returns the current system data and time Syntax Now() OpenTextFile Function Opens a text file or creates a new file Syntax

Creating Procedures, Loops, and Arrays

Set Var = object.OpenTextFile(Filename,Iomode,Create[,Format]) Arguments Var A variable for the File object Object A File System object File The name and path for the text file

IOmode 1 for read-only, 2 to overwrite the existing contents of the file, or 8 to append to the file Create True to create a file or False to not create the file

Format 1 for unicode, 0 for ASCII, or -2 to use the system default setting. If omitted, the format is ASCII. WriteLine Function Writes a line to a text file Syntax

object.WriteLine Text Arguments

a r O
object 5-12

The File object to which to write the text

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

Module 2 Creating Procedures, Loops, and Arrays Lesson 5 Creating Custom Procedures Text The text to write to the file. The text is written as a new line in the file. Enclose literal text strings in quotation marks.

a r O

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

5-13

Module 2 Lesson 5 Creating Custom Procedures

Creating Procedures, Loops, and Arrays

Calling Write to File Procedures


Sub Calculate pov_entity=HS.Entity.Member pov_scenario=HS.Scenario.Member Call WriteToFile("Calc procedure started for " &pov_entity & _ " " &pov_scenario) HS.Exp "C1#Opening=C1#Closing.Y#Prior.P#Last" Call WriteToFile("Calc procedure ended") End Sub

Copyright 2008, Oracle. All rights reserved.

Calling Write to File Procedures

You can call a write to file procedure from any location in a rules script. Before calling the file, you should store the information in variables. You can then pass the variables to the write-to-file procedure. If you open the text file in append mode, you can call the procedure repeatedly during script execution. Each line is appended to the end of the file.

a r O
5-14

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

Module 2 Creating Procedures, Loops, and Arrays Lesson 5 Creating Custom Procedures For the example on the slide, the first call to the write-to-file procedure passes the entity and scenario for which the Calculate procedure is being run. The second call to the write to file procedure indicates the end of the procedure.
NOTE

Because writing to a log file impacts performance, you should use custom logging only during development and testing of your application. You should disable all calls to write-to-file procedures before the application goes to production. An easy way to disable call is to place apostrophes in front them. This turns them into comment lines.

a r O

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

5-15

Module 2 Lesson 5 Creating Custom Procedures

Creating Procedures, Loops, and Arrays

Managing Log Files


VBScript provides functions that enable you to manage log files.
Dim FileSize, fso, f, s, MaxSize=1048576 Set fso = CreateObject("Scripting.FileSystemObject") Set f = fso.GetFile("c:\ruleslog.txt") s = f.size If MaxSize < s then Set f = fso.OpenTextFile(c:\ruleslog_deleted.txt,8, True) f.WriteLine "c:\ruleslog.txt reached size limit" f.WriteLine "of " & MaxSize & " and was deleted at" &Now() f.Close fso.DeleteFile("c:\ruleslog.txt") End If

Copyright 2008, Oracle. All rights reserved.

Managing Log Files

Log files can quickly fill with large amounts of data, but you can manage log files with VBScript functions. These are some of the tasks you can perform: Check for the existence of a file Check the file size

Move a log file to a new location Delete a log file

a r O
5-16

The example on the slide shows a routine that checks the size of the log file and deletes it if it exceeds a specified limit. The GetFile function assigns the log file c:\ruleslog.txt to the variable f. The Size function retrieves the size of c:\ruleslog.txt. If the size is larger than the size specified in the MaxSize variable, the FileDelete function deletes the file.

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

The following sections describe the functions for managing files.

Hyperion Financial Management 9.3.1: Create Rules

Module 2 Creating Procedures, Loops, and Arrays Lesson 5 Creating Custom Procedures

DeleteFile Function
Deletes a file. Syntax object.DeleteFile(filespec[,force]) Arguments Object A File System object filespec The path and name of a file force True if read-only files should be deleted, or False if they should not. If this argument is omitted, the default is False.

FileExists Function
Returns True if the specified file exists or False if it does not. Syntax object.FileExists(filespec) Arguments Object

A File System object filespec

The path and name of a file

GetFile Function
Syntax

Returns a File object corresponding to the file in a specified path

a r O

object.GetFile(filespec)

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

5-17

Module 2 Lesson 5 Creating Custom Procedures Arguments Object A File System object filespec The path and name of a file

Creating Procedures, Loops, and Arrays

MoveFile Function
Moves a file from one location to another Syntax object.MoveFile source, destination Arguments Object A File System object source The path and name of the file to move destination The path to which to move the file

Size Function
Syntax object.Size Arguments A File object

Returns the size of a File object

a r O
5-18

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

Module 2 Creating Procedures, Loops, and Arrays Lesson 5 Creating Custom Procedures

Summary
In this lesson, you should have learned to: Create custom Sub procedures Create custom Function procedures Troubleshoot rules scripts with custom logging procedures Manage log files

a r O

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

5-19

Module 2 Lesson 5 Creating Custom Procedures

Creating Procedures, Loops, and Arrays

a r O
5-20

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

L E S S O N

6
6

Creating Arrays and Loops

Objectives
At the end of this lesson, you should be able to: Describe arrays and loops Create arrays Fill arrays using member lists Create loops Assign values with arrays and loops Work with member attributes in loops Open data units Create loops with data units

a r O

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Module 2 Lesson 6 Creating Arrays and Loops

Creating Procedures, Loops, and Arrays

Arrays
Arrays are variables that hold multiple values. Each array value has an index number. You write values, to or read values from, the array by referencing the index number.
aProducts

Lower bound

0 1 2

Steel Wood Brick Plas tic

Dim aProducts(4) aProducts(0)=Steel aProducts(1)=Wood aProducts(2)=Brick aProducts(3)=Plastic

Upper bound

Copyright 2008, Oracle. All rights reserved.

Arrays

You can create these types of variables:

Standard variables, also called scalar variables, store a single value. Array variables store a list of values.

a r O
6-2

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

Module 2 Creating Procedures, Loops, and Arrays Lesson 6 Creating Arrays and Loops

Loops
Loops are sections of code that repeat execution for a specified number of times or until a condition is met.
Dim Counter For I = 1 to 100 Counter=Counter + 1 Next

Copyright 2008, Oracle. All rights reserved.

Loops

Loops can reduce the size of your script. For example, instead of creating 20 lines of script to calculate 20 account values, you can create a loop that repeats a single line of script 20 times, specifying a different account for each iteration.

a r O

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

6-3

Module 2 Lesson 6 Creating Arrays and Loops

Creating Procedures, Loops, and Arrays

Arrays and Loops in Rules


Frequently you need to write rules that execute for a subset of members in a dimension. You cannot always specify the subset precisely with HS.Exp. Loops and arrays enable you to write concise rules that perform actions on large subsets of dimension members.
aOver
0 1 2 3 4 5 6 Travel RentRates Phone Stationery Salaries Pensions Sundry

For i = 0 to 6 HS.Exp "A#Expenses.C2#"& (aOver(i))& =A#Expenses.P#Prior Next


Copyright 2008, Oracle. All rights reserved.

Arrays and Loops in Rules

As you learned earlier, the HS.Exp function can write data to either a single member of a subcube dimension or to all valid members of the dimension: If you specify a dimension member on the destination (left) side of HS.Exp, it writes data only to that member of the dimension. If you omit the dimension from the destination (left) and source (right) sides of HS.Exp or include it only on the source (right) side, it writes to all valid members of the dimension. But frequently you need a rule to act on a subset of dimension members. For example, you might need a rule that writes values to all accounts that are descendants of the Total Expenses account, but to no others. If there were 50 descendants of Total Expenses, you would need 50 HS.Exp statements.

a r O
6-4

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

Module 2 Creating Procedures, Loops, and Arrays Lesson 6 Creating Arrays and Loops Similarly, you must frequently limit the members of the Entity, Scenario, Year, or Period dimension for which a rule executes. Using an If...Then or Select...Case statement is convenient if there are a small number of members, but it becomes problematic with many members. For example, you might need a rule that executes only for entities that have Eur as their default currency. If there were 25 entities with Eur as their default currency, you would need an If...Then statement or a Select...Case statement with 25 conditions, which would be difficult to write and maintain. You can use loops and arrays to work with large subsets of members. You first load the members into an array. You then use a loop to repeat the execution of a rule for each member in the array. For the example on the slide, the Overhead members of the Custom2 dimension are stored in an array variable named aOver. A loop is used to perform a calculation for each member in the array.

a r O

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

6-5

Module 2 Lesson 6 Creating Arrays and Loops

Creating Procedures, Loops, and Arrays

Creating Array Variables


Creating an array variable is similar to creating a scalar variable, but you include parentheses with the number of items for the array.
Dim aProducts(5) Dim aAccts(10)

To add items to or retrieve items from the array, specify the index number for the item in parenthesis.
aAccts(0)=Taxes aAccts(1)=Discounts aAccts(2)=Returns
Adds three items to aAccts and assigns them index numbers Retrieves the Returns item from aAccts and stores it in vTarget

vTarget=aAccts(2)

Copyright 2008, Oracle. All rights reserved.

Creating Array Variables

You create array variables the same way that you create standard variables, except you specify the number of items for the array in parentheses next to the variable name. Array variables use a zero-based index; that is, the index number for the first item is zero. As a result, array variables contain one more item than the number specified in parentheses. For the example on the slide, the aProducts variable would contain items 0 to 5. You assign data to each element of the array by using an index into the array. Similarly, the data can be retrieved from any element by using an index into a particular array element. This example sets the value of the ninth item in the aEntity array variable to Europe: aEntity(8)=Europe This example retrieves the tenth item from aEntity and stores it in the vCurrEntity variable: vCurrEntity=aEntity(9) 6-6 Hyperion Financial Management 9.3.1: Create Rules

a r O

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Module 2 Creating Procedures, Loops, and Arrays Lesson 6 Creating Arrays and Loops

Filling Arrays Using Member Lists


Examples of HS.List:
All accounts in the Account dimension:

aAccts=HS.Account.List("","")
All base accounts in the Account dimension:

aAccts=HS.Account.List("", "[Base]")
All children of the entity France:

aEntity=HS.Entity.List("France","[Children]")
All accounts in the user-defined member list Taxable:

aAccts=HS.Account.List("","Taxable")

Copyright 2008, Oracle. All rights reserved.

Filling Arrays Using Member Lists

You can use the HS.List function to fill an array variable with the members from a member list. Syntax

HS.Dimension.List("Parent","Listname")
Parameter Dimension Parent Description

Listname

a r O

e l c

e l c a r O ly & On l a e n r s e t U n I
A dimension name.

c A

e d a

y m

Optional. The name of the top parent member for a system-defined list. The name of a valid system list or a user-defined member list.

Hyperion Financial Management 9.3.1: Create Rules

6-7

Module 2 Lesson 6 Creating Arrays and Loops

Creating Procedures, Loops, and Arrays

Creating Loops
You can use these statements to create loops: For...Next: Using a counter to run statements a specified number of times For Each...Next: Repeating a group of statements for each object in a collection Do...Loop: Looping while or until a condition is true

Copyright 2008, Oracle. All rights reserved.

Creating Loops
For...Next

You can create several types of loops in VBScript.

Repeats the execution of a block of statements a specific number of times. For loops use a counter variable whose value is automatically increased or decreased with each repetition of the loop. You specify the initial value for the counter variable and the maximum value the counter can reach for the block of code to be executed. Syntax

a r O
6-8

For Counter = StartVal To EndVal ... ... Next

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

Module 2 Creating Procedures, Loops, and Arrays Lesson 6 Creating Arrays and Loops
Parameter Counter StartVal EndVal Description A name for the counter variable The initial value for counter variable. The maximum value for counter variable.

Example The following loop makes the computer beep 21 times. The For statement specifies the counter variable name as x. It specifies 0 as the start value for x and 21 as the end value. The Next statement increments the counter variable by 1 after each iteration. For x = 0 To 20 Beep Next

For Each...Next
Repeats a block of statements for each element in an array. All statements execute for each element in the array until there are no more elements. You specify a variable that returns the index for the current element in the array. Syntax For Each Item in ArrayVariable ... ... Next Parameter Item

A variable name for the counter variable. ArrayVariable

The name of an array variable Example

In the following script, Item is the counter variable and BeepCount is an array variable. The computer beeps for as many items as there are in the BeepCount array variable.

a r O

For Each Item in BeepCount Beep Next

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

6-9

Module 2 Lesson 6 Creating Arrays and Loops

Creating Procedures, Loops, and Arrays

Do...Loop
Runs a block of statements an indefinite number of times. The statements are repeated either while a condition is true or until a condition becomes true. Repeating Statements While a Condition is True You use the While keyword with a Do loop to run a block of statements while a condition is true. Syntax Do While Condition ... ... Loop Parameters Condition An expression that evaluates to true or false Example

In the following script, the statements inside the loop run while the value of myNum is 10 or less. myNum = 0 Do While myNum < 11 myNum = myNum + 1 Loop

Repeating Statements Until a Condition Becomes True You use the Until keyword with a Do loop to run a block of statements until a condition becomes true. Syntax

Do Until Condition ... ... Loop Parameters

a r O
6-10

Condition

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

An expression that evaluates to true or false

Hyperion Financial Management 9.3.1: Create Rules

Module 2 Creating Procedures, Loops, and Arrays Lesson 6 Creating Arrays and Loops Example In the following script, the statements inside the loop execute until the value of myNum reaches 11. myNum = 0 Do Until myNum = 11 myNum = myNum + 1 Loop

a r O

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

6-11

Module 2 Lesson 6 Creating Arrays and Loops

Creating Procedures, Loops, and Arrays

Assigning Values with Arrays and Loops


The counter variable increments the index number of the array variable to retrieve a different member from the array at each iteration of the loop. Use the Lbound and Ubound functions to retrieve the number of items in the array.
aQTDAccts = HS.Account.List("", "QTD_Accounts") For i=LBound(aQTDAccts) to UBound(aQTDAccts) HS.Clear("A#"& aQTDAccts(i)&".C2#QTD") Next

aProds = HS.Custom2.List("","[Base]") For Each ProdItem in aProds HS.Exp "A#SalesTax.C2#" &ProdItem& "=A#Sales*.06" Next

Copyright 2008, Oracle. All rights reserved.

Assigning Values with Arrays and Loops


To assign values with arrays and loops:

You can use arrays and loops to assign values to accounts in Financial Management.

1. Assign a system or user-defined member list to an array variable by using the HS.List function. 2. Create a loop that executes for each element in the array variable. 3. Use the loop counter variable to specify the index for the array variable.

a r O
6-12

e l c

Because the loop counter variable is incremented by one each time the loop executes, each iteration of the loop retrieves a different member from the array variable. You can insert the array variable in any location in your script where an array member name is required.

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

Module 2 Creating Procedures, Loops, and Arrays Lesson 6 Creating Arrays and Loops With For...Next loops, you must specify a start number and an end number for the counter variable. But often you do not know the number of items in the array. You can use the Lbound function to retrieve the index number of the first item in the array and the Ubound function to retrieve the index number of the last item. For Each...Next loops automatically repeat for each member in the array, so the Lbound and Ubound functions are not needed.

a r O

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

6-13

Module 2 Lesson 6 Creating Arrays and Loops

Creating Procedures, Loops, and Arrays

Attributes in Loops
You can use member attributes to select the members of an array for which a rule is executed.
aProds = HS.Custom2.List("","[Base]") For Each ProdItem in aProds IF HS.Custom2.UD1(ProdItem)="Taxable" Then HS.Exp "A#SalesTax.C2#" &ProdItem& "=A#Sales*.06 End If Next

Copyright 2008, Oracle. All rights reserved.

Attributes in Loops

There may not be a system or user-defined member list that defines the precise subset of members that you need to include in a loop. You can use member attributes as additional criteria for selecting members for which rules are executed. For the example on the slide, the Custom2 dimension contains products. The rule should execute only for base-level members of Custom2 that have the user-defined attribute Taxable. To accomplish this: A system member list is used to fill the array variable aProds with the base-level members of the Custom2 dimension. A For...Each loop is used to loop through each of the members in the array variable. The counter variable for the loop is ProdItem.

a r O
6-14

At each iteration of the loop, an If...Then statement retrieves the value of the UD1 attribute for the current array item and tests whether it contains the text Taxable. Notice that ProdItem is used to retrieve the item from the array variable. Hyperion Financial Management 9.3.1: Create Rules

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Module 2 Creating Procedures, Loops, and Arrays Lesson 6 Creating Arrays and Loops

Loops and Data Units


A data unit includes records for all intersections that have data for a specified Point of View. Data units provide an alternative to member lists for specifying a subset of data for a loop. You can use data units for rules that only apply to account intersections that already have data.
Set DataUnit=HS.OpenDataUnit("A#Returns")

California Budget 2006 April <Entity Currency>


Account Returns Returns Returns Returns ICP [ICP None] [ICP None] [ICP None] [ICP None] C1 [None] [None] [None] [None] C2 Wood Brick Steel Plastic C3 Retail Retail Retail Retail C4 [None] [None] [None] [None] View Periodic Periodic Periodic Periodic NODATA 350 NODATA 500

Copyright 2008, Oracle. All rights reserved.

Loops and Data Units

Member lists return a list of members in a dimension regardless of whether data exists for those members. But a rule often needs to execute only for intersections of members that have data. Financial Management provides functions that enable you to limit the scope of rules to intersections that have data. You do this by creating loops with data units. A data unit is the set of intersections that contain data for a specified Point of View. For the example on the slide, the data unit includes all member intersections for the Returns account that have data for the current Point of View.

a r O

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

6-15

Module 2 Lesson 6 Creating Arrays and Loops

Creating Procedures, Loops, and Arrays

Opening Data Units


Use HS.OpenDataUnit to open a data unit. If you omit an Account, ICP or Custom dimension, all base members with data for that dimension are included in the data unit.
Set TaxData=HS.OpenDataUnit("E#East.A#Taxes")

Use the GetItem function to retrieve an item from a data unit.


I=5 HS.TaxData.GetItem (I,Acct,ICP,Cust1,Cust2,Cust3,Cust4,Val) HS.Exp "A#" &Acct& ".C1#" &Cust1& "=" &Val

Copyright 2008, Oracle. All rights reserved.

Opening Data Units


Syntax

You use the Set command with the OpenDataUnit function to open a data unit.

Set DataUnit=HS.OpenDataUnit("DimensionMembers") Parameter


DataUnit

A variable for the data unit


DimensionMembers

The Point of View for the data unit

a r O
6-16

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

Module 2 Creating Procedures, Loops, and Arrays Lesson 6 Creating Arrays and Loops You do not need to specify all dimensions in the Point of View: If you omit the Scenario, Year, Period, or Value dimensions, the current Point of View member is used. If you omit the View dimension, the default view of the specified scenario member (if defined) or the current scenario is used. If you omit an Account, ICP or Custom dimension, all members with data for that dimension are included in the data unit. For the example on the slide, member intersections with data for the Tax account for the East entity are included in the TaxData data unit. After you open a data unit, you use the GetItem function to retrieve data for items in the data unit. Syntax call DataUnit.GetItem (Item,Acct,ICP,C1,C2,C3,C4,dData) Parameters
Parameter DataUnit Item Acct ICP C1, C2, C3, C4 dData Description A variable for the data unit. The index number of the item to retrieve.

For the example on the slide, the GetItem function is used to retrieve the fifth item in the data unit. The Acct, Cust1, and Val variables are used to insert the Account member, Custom1 member, and the data for the item into the HS.Exp expression.

a r O

e l c

e l c a r O ly & On l a e n r s e t U n I
A variable to store the data for the item.

A variable to store the Account member for the item.

A variable to store the ICP member for the item.

c A

e d a

y m

Variables to store the custom dimension members for the item.

Hyperion Financial Management 9.3.1: Create Rules

6-17

Module 2 Lesson 6 Creating Arrays and Loops

Creating Procedures, Loops, and Arrays

Creating Loops with Data Units


Use the GetINumItems function to determine the number of items in the data unit. Use the same variable for the loop counter and the GetItem index.
If HS.Scenario.Member="Forecast" then Set ActData=HS.OpenDataUnit("S#Actual.A#Returns.Y#Prior") vNumItems=ActData.GetNumItems If vNumItems > 0 Then For i=0 to vNumItems-1 Call ActData.GetItem(i,vAcct,vICP,vCust1,vCust2,vCust3,vCust4,vData) If HS.Custom2.UD1(vCust2)="001" Then HS.Exp "A#Returns.C2#" &vCust2& ".C3#" &vCust3& "=" &vData& "* 1.10" End If Next End If End If

Copyright 2008, Oracle. All rights reserved.

Creating Loops With Data Units

Looping through a data unit is similar to looping through an array created with a member list. The first index for the first element in the data unit array is always zero. To determine the total number of items in the array, use the GetNumItems function. Because numbering of the items starts at zero, the index of the last item in the array will be the total number of items minus 1. In the example on the slide, the value for the Returns account for each product with the code 001 for the Forecast scenario is calculated as a 10% increase over the prior year actual values. Because there is no need to perform the calculation for products for which prior year actual data does not exist, the OpenDataUnit function is used to retrieve just those products that have data. The following is a line by line explanation:

a r O
6-18

Line 1: An If...Then statement is used to limit the rule to the Forecast scenario.

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

Module 2 Creating Procedures, Loops, and Arrays Lesson 6 Creating Arrays and Loops Line 2: The OpenDataUnit function is used to retrieve all prior year actual data for the Returns account. The data unit is assigned to the variable ActData. Line 3: The number of items in the data unit is stored in the variable vNumItems. Line 4: If prior year actual data for Returns does not exist, the OpenDataUnit function does not return any items. This line verifies that there are items to be processed. Line 5: A For...Next statement is used to create a loop that repeats for every item in the data unit. The variable i is used as a counter. Line 6: The GetItem function is used to retrieve items from the data unit. The variable i is used for the index variable so that it is incremented at each iteration of the For...Next loop. Notice that vCust2 is the variable for the Custom2 member, which is the dimension that contains products. Line 7: The calculation should execute only for products with the code 001. The user UD1 attribute of the Custom2 member is checked to see if its value is 001. The vCust2 variable is used to specify the current member of custom2 returned by the GetItem function. Line 8: The HS.Exp function is used to calculate the value for the Returns account. Because Custom1 and Custom4 are not valid for the Returns account, they are omitted from the HS.Exp function. The vData variable stores the prior year Actual value returned by the GetItem function.

a r O

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

6-19

Module 2 Lesson 6 Creating Arrays and Loops

Creating Procedures, Loops, and Arrays

Summary
In this lesson, you should have learned to: Describe arrays and loops Create arrays Fill arrays using member lists Create loops Assign values with arrays and loops Work with member attributes in loops Open data units Create loops with data units

a r O
6-20

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

M O D U L E

3
6

Working with Data and Hierarchies

Overview
In this module you learn how to work with Financial Management data and hierarchies. Lessons in this module include: Managing Financial Management Data Working with Dimension Hierarchies

a r O

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

a r O

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

L E S S O N

7
7

Managing Financial Management Data

Objectives
At the end of this lesson, you should be able to: Retrieve data with the GetCell function Write data with the SetDataWithPOV function Test for no data Set accounts to no input or input Round and scale account values

a r O

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Module 3 Working With Data and Hierarchies Lesson 7 Managing Financial Management Data

Retrieving and Writing Data


GetCell function: Retrieves data from a single data intersection or cell; stores the data in a variable to use in a calculation or to assign to an account.
Dim vData, vCustoms vCustoms=".C1#[None].C2#TopC2.C3#TopC3.C4#[None].I#[ICP None]" vData=HS.GetCell("A#Sales" &vCustoms)

SetDataWithPOV function: Writes data to a single data intersection or cell; accumulates or replaces data.
Dim vData vData=500 vPOV="A#Acc1.I#[ICP None].C1#[None].C2#[None].C3#[None]"& _ ".C4#[None]" Call HS.SetDataWithPOV(vPOV,vData,True)

Copyright 2008, Oracle. All rights reserved.

Retrieving and Writing Data

So far, you have used the Exp function to read and write account values. Financial Management rules provide other functions for reading and writing data to data intersections. The Exp function retrieves data from a source account or accounts and writes it to a destination account or accounts. However, sometimes you need to store data to a variable instead of an account. For example, you might want to retrieve the value for TotalHeadcount and store it in a variable, which you then use for a series of calculations. The GetCell function enables you to retrieve data from a specified data intersection or cell and store it in a variable.

a r O
7-2

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

Module 3 Working With Data and Hierarchies Lesson 7 Managing Financial Management Data GetCell Function Retrieves data from a specified data intersection or cell and stores it in a variable. Syntax HS.GetCell("POVExpression") Parameter POVExpression A valid Point of View. You can include any dimension in the POV expression. If you omit the Entity, Scenario, Year, or Period dimensions, the current Point of View is used. SetDataWithPOV Function You may need to add to the existing values for an account rather than overwrite them. You can use the SetDataWithPOV option to write data to a specified data intersection or cell. You can choose to overwrite the data for the cell or add to the existing data. Writes data to a specified data intersection or cell. Syntax HS.SetDataWithPOV(POV,Data,Add) Parameter
Parameter POV Data Add Description

A valid expression. You must include members for the Account, custom, and ICP dimensions. No other dimensions are valid. The data value to set.

True to accumulate the data or False to replace the data.

a r O

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

7-3

Module 3 Working With Data and Hierarchies Lesson 7 Managing Financial Management Data

Testing for No Data


If the source for HS.Exp is an account expression, HS.Exp detects if there is no data and does not write to the destination. If the source for HS.Exp is a constant, HS.Exp cannot detect if there is no data and can potentially write zeros to the database. You can use a conditional to test for no data or for zeros.
Dim vData vCustoms=".C1#[None].C2#Wood.C3#C_Retail.C4#[None].I#[ICP None]" vData = HS.GetCell("A#Sales" &vCustoms)* 1.1 If vData <> 0 Then HS.Exp "A#Sales"& vCustoms"="&vData End IF

Use the GetCellNoData or GetCellRealData function to test for no data.

Copyright 2008, Oracle. All rights reserved.

Testing for No Data

If there is no data for the Point of View from which you retrieve data, the GetCell function returns zero. If you write the results returned by GetCell to the database, zeros may be written unnecessarily. The result is an increased database size. If you use the value returned by GetCell in a calculation, the result may be division by zero errors. You should verify that there is data before writing data returned by GetCell to the database or using it as a divisor in a calculation: Conditional testYou can add a simple conditional test for zero data before writing to the database. For the example on the slide, the value retrieved by GetCell is stored in the vData variable. An If...Then statement verifies that vData does not equal zero before the value for vData is written to the database.

a r O
7-4

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Variations of GetCellFinancial Management provides the GetCellNoData and GetCellRealData functions to test for no data. Hyperion Financial Management 9.3.1: Create Rules

Module 3 Working With Data and Hierarchies Lesson 7 Managing Financial Management Data GetCellNoData Function Gets the data contained in a cell and indicates if the cell contains no data. Syntax HS.GetCell("POVExpression,Var") Parameter POVExpression A valid Point of View. You can include any dimension in the POV expression. Var A variable that returns True if there is no data and False if there is real data or derived data. Example vCustoms=".C1#[None].C2#Wood.C3#C_Retail.C4#[None].I#[ICP None]" vData=HS.GetCellNoData(A#GrossSales &vCustoms,IsEmpty)*1.1 If Not IsEmpty Then HS.Exp "A#Sales &vCustoms& "=" &vData End If GetCellRealData Function Gets the data contained in a cell and indicates if the cell contains real data. Syntax

HS.GetCellRealData("POVExpression,Var") Parameters POVExpression Var

A valid Point of View. You can include any dimension in the POV expression. A variable that returns True if there is real data and False if there is no data or derived data. Example

a r O

vCustoms=".C1#[None].C2#Wood.C3#C_Retail.C4#[None].I#[ICP None]" vData=HS.GetCellRealData(A#GrossSales &vCustoms,IsReal)*1.1 If IsReal Then HS.Exp "A#GrossSales &vCustoms& "=" &vData End If 7-5

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

Module 3 Working With Data and Hierarchies Lesson 7 Managing Financial Management Data

Setting Accounts to No Input


Sub NoInput procedure: Can be used for accounts where some data intersections must be calculated and others must be input Does not recognize the current Point of View Allows use of loops and member lists
Sub NoInput HS.NoInput "S#Budget.Y#2006.A#Sales" HS.NoInput "S#Forecast.Y#2006.A#Sales" End Sub

Copyright 2008, Oracle. All rights reserved.

Setting Accounts to No Input

When setting up calculated accounts using the IsCalculated attribute, in effect, you prevent users from inputting to the accounts. However, you must often enable data input for only some dimension intersections. You can use the Sub NoInput procedure with the NoInput function to disable input for specified data intersections. For example, you can input data for a set of accounts in the Actual scenario and have it calculated in the Forecast scenario. Sub NoInput Procedure

When used with the NoInput function, disables input to accounts for specified data intersections

a r O
7-6

Syntax

Sub NoInput HS.NoInput "POVExpression" End Sub Hyperion Financial Management 9.3.1: Create Rules

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Module 3 Working With Data and Hierarchies Lesson 7 Managing Financial Management Data Parameters POVExpression Any valid Point of View Description The Sub NoInput procedure executes when the application is opened. Therefore, a large Sub NoInput procedure increases (sometimes dramatically) the time required to open the application. Because the NoInput rules execute when the application is opened, there is no concept of current Point of View. You must explicitly specify dimension members in the POVExpression parameter of the NoInput function; they do not default to the current Point of View if omitted. When setting many intersections to no input, you can use loops with member lists within the Sub NoInput procedure. Example For the example on the slide, input is disabled for cells that intersect the Sales account and the Budget and Forecast scenarios for the year 2006.

a r O

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

7-7

Module 3 Working With Data and Hierarchies Lesson 7 Managing Financial Management Data

Setting Parent Entities to Input


Sub Input procedure: You can use it to enable data entry for parent entities. Children contributions do not roll up to the parent's Entity Currency member in the Value dimension.
Sub Input HS.InputE#California.S#Forecast" End Sub

Copyright 2008, Oracle. All rights reserved.

Setting Parent Entities to Input

If you want to enter data for some entities at the parent level, you can use the Sub Input procedure with the Input function to enable data input into parent entities at base accounts. For example, you can enter a Sales budget target for the parent entity California and allocate the target to its children. Sub Input Procedure

When used with the Input function, enables data input at the parent entity level Syntax

a r O
7-8

Sub Input HS.Input "POVExpression" End Sub

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

Module 3 Working With Data and Hierarchies Lesson 7 Managing Financial Management Data Parameters POVExpression Any valid Point of View Description Only the Entity Currency member of the Value dimension is supported. When you use this function, the value at the parent entity level is not equal to the sum of its childrens contributions. Because this function enables input at the parent entity level, the children contributions do not roll up to the parent entitys Entity Currency member. However, the parent-child contribution value is stored, and you can still post journals to the Contribution Adjustments member. Because the Input rules execute when the application is opened, there is no concept of current Point of View. You must explicitly specify dimension members in the POVExpression parameter; if omitted, they do not default to the current Point of View. Example For the example on the slide, input into parent entities is enabled for the cells that intersect the Sales account and the Budget scenario.

a r O

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

7-9

Module 3 Working With Data and Hierarchies Lesson 7 Managing Financial Management Data

Rounding and Scaling Overview


Rounding or Scaling the stored base-level values prevents footing problems. The VBScript Round function enables you to round to a specified number of decimal places, but does not use financial rounding and does not support scaling. The HS.Round function enables you to round and scale stored values using financial rounding.
With scaling and rounding differences, parent totals may not foot.
Rounding Stored Wood Brick Steel 103.48 104.43 150.35 359.26 Rounded 103 104 150 359 Wood Bric k Steel Sc aling Stored 150,440 120,320 110,390 381,150 Scaled 150 120 110 381

Total

Total

Copyright 2008, Oracle. All rights reserved.

Rounding and Scaling Overview

Data is frequently loaded into the system at a greater precision than is required for reporting purposes. The result is footing problems at the parent level in reports. You can use the VBScript Round function to resolve this problem. The VBScript Round function does not use financial rounding. If the number to the left of the decimal point is even, values of 5 are rounded down, not up. For example, 3.5 rounds to 4, but 2.5 rounds to 2. The Round function cannot scale values by rounding whole numbers; for example, hundreds to thousands. Round Function

a r O
7-10

Rounds values to a specified level of decimals or to an integer before storing them

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

Module 3 Working With Data and Hierarchies Lesson 7 Managing Financial Management Data Syntax Round(Expression [,NumDecimalPlaces]) Parameters Expression The numeric expression being rounded. NumDecimalPlaces Number indicating how many places to the right of the decimal are included in the rounding. If this parameter is omitted, an integer is returned.

a r O

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

7-11

Module 3 Working With Data and Hierarchies Lesson 7 Managing Financial Management Data

Rounding and Scaling with HS.Round


HS.Round is a switch that turns rounding or scaling on or off for sections of the rules script. If HS.Round is enabled, all values written to the database are rounded or scaled to a specified precision.
HS.Round 1000 HS.Exp "A#GrossSalesRnd=A#GrossSales" HS.Exp "A#DiscountsRnd=A#Discounts" HS.NoRound

Copyright 2008, Oracle. All rights reserved.

Rounding and Scaling with HS.Round

When rounding is enabled with HS.Round, all values written to the database from the following line of script onward are rounded or scaled. HS.Round Function

Rounds and scales stored values using financial rounding Syntax

HS.Round(Unit)

a r O
7-12

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

Module 3 Working With Data and Hierarchies Lesson 7 Managing Financial Management Data Parameters Unit A factor for rounding or scaling. For example, a value of 0.1 rounds to the nearest tenth. A value of 100 rounds to hundreds. Description To switch off scaling, use the HS.NoRound function, which takes no parameters. You can also switch off rounding by using the HS.Round function with a factor of zero. Example For the example on the slide, the HS.Round function enables rounding to thousands. Rounded values for GrossSales and Discounts are written to rounding accounts. The HS.NoRound function then disables rounding.

a r O

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

7-13

Module 3 Working With Data and Hierarchies Lesson 7 Managing Financial Management Data

Summary
In this lesson, you should have learned to: Retrieve data with the GetCell function Write data with the SetDataWithPOV function Test for no data Set accounts to no input or input Round and scale account values

a r O
7-14

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

L E S S O N

8
8

Working with Dimension Hierarchies

Objectives
At the end of this lesson, you should be able to: Work with the calendar Manage movement accounts and data views Avoid circular references in hierarchies Create allocations

a r O

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Module 3 Working With Data and Hierarchies Lesson 8 Working with Dimension Hierarchies

Working with the Calendar


Preventing Prior and Next from Crossing into Invalid Years Populating days in period account Managing calculation status

Copyright 2008, Oracle. All rights reserved.

Working with the Calendar

When you create an application, the Period, Year, and View dimensions are generated based on the application profile. The Period, Year, and View dimensions comprise the Financial Management calendar.

a r O
8-2

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

Module 3 Working With Data and Hierarchies Lesson 8 Working with Dimension Hierarchies

Preventing Prior and Next from Crossing into Invalid Years


Rules can reference members in earlier and later periods. The Prior and Next keywords can cross years but cannot distinguish between interim years and first and last year.
If Not HS.Period.IsFirst Then HS.Exp "A#SalesChange=A#SalesA#Sales.P#Prior" End IF If HS.Year.Member<>"2005" Then HS.Exp "A#Opening=A#Closing.P#Prior" End IF

Copyright 2008, Oracle. All rights reserved.

Preventing Prior and Next from Crossing into Invalid Years


In rules, you use the First, Last, Prior, and Next keywords to dynamically select earlier and later periods and years. Year and Period are separate dimensions. However, if the current period is the first period in a year, the Prior function, used with the Period dimension, crosses to the last member of the previous year. For example, if the current period is January, 1996, the syntax P#Prior retrieves the value for December, 1995. Similarly, if the current period is the last period in a year, the P#Next crosses to the next year. The Prior and Next keywords, however, do not distinguish between interim years and first and last years. Therefore, if a rule tries to retrieve data from a year prior to the first year or after the last year, an error is returned. For example, if the current year is the first year, the syntax Y#Prior returns an error. Similarly, if the current year is the first year and the current period is the first period, the syntax P#Prior returns an error.

a r O

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

8-3

Module 3 Working With Data and Hierarchies Lesson 8 Working with Dimension Hierarchies When creating rules that use the Prior or Next keywords, you should include tests to ensure that the rules do not reference invalid years. You can use either member names or the IsFirst and IsLast functions to test for first or last year or period. For the first example on the slide, the rule calculates the change in Sales between periods. If the current period is the first period, the IsFirst function, used with the Period dimension, prevents execution of the calculation and thus prevents the calculation from crossing into earlier years, even if the earlier year is not the first in the application. For the second example on the slide, opening balances are calculated as equal to prior period closing balances during all years but the first year. An If...Then statement is used with the member name of the first year to exclude the first year from the calculation. The IsFirst function could have been used.

a r O
8-4

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

Module 3 Working With Data and Hierarchies Lesson 8 Working with Dimension Hierarchies

Populating Days in Period Accounts

If Hs.Entity.Member="[None]" Then Select Case UCase(HS.Period.Member) Case "FEB" IF HS.Year.Member mod 4=0 Then HS.Exp "A#DAYS.W#Periodic=29" Else HS.Exp "A#DAYS.W#Periodic=28" End IF Case "APR", "JUN", "SEP", "NOV" HS.Exp "A#DAYS.W#Periodic=30" Case Else Hs.Exp "A#DAYS.W#Periodic=31" End Select End if

Copyright 2008, Oracle. All rights reserved.

Populating Days in Period Accounts

The Period dimension does not recognize the number of days in each period. For rules that require the number of days in a period, you create days in period accounts and use rules to populate the accounts. Because days in period data is typically global data valid for all entities, set the None member of the Entity dimension as the destination. If your rules need to accommodate leap years, include a leap-year test. Use the VB Script mod operator to divide the number of days of the current year by 4. Mod returns just the remainder of a division. If the remainder value returned is zero, the current year is a leap year.

a r O

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

8-5

Module 3 Working With Data and Hierarchies Lesson 8 Working with Dimension Hierarchies

Managing Calculation Status


Impact Status function: Flags a period as needing calculation Is used to manage future-year calculation status
If Not HS.Year.IsLast Then If HS.Period.IsLast Then HS.ImpactStatus "Y#NEXT.P#FIRST" End If End If

Copyright 2008, Oracle. All rights reserved.

Managing Calculation Status

When you update data for a period, calculation statuses of future periods of the current year are impacted, but calculation statuses of future years are not impacted. For example, if the calculation status for January, 2006 is OK and values are changed for December, 2005, the calculation status for January, 2006 remains OK. Often, calculations defined in rules include dependencies between years. If you want data updates to impact future years, you specify a year, period, entity, and scenario and use the ImpactStatus function. Rules for opening balances are an example of when you need to use the ImpactStatus function. For balance sheet accounts, opening balances are typically retrieved from the last period of the prior year using a rule. If data for the last period of the prior year changes, opening balances for the current year need to be recalculated. You can use the ImpactStatus function to ensure that, when a rule modifies data for the last period of a year, the calculation status of the first period of the following year is impacted.

a r O
8-6

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

Module 3 Working With Data and Hierarchies Lesson 8 Working with Dimension Hierarchies Syntax HS.ImpactStatus POVExpression Parameters POV Expression Any combination of valid Scenario, Year, Period, Entity, and Value members. You can use the First, Last, Prior, and Next keywords with the Period and Year dimensions. Remarks If the scenario in the POVExpression parameter is the same as the current point of view, the year and period combination must identify a future period. If the default frequency of the scenario from which the ImpactStatus function is executed has a different default frequency than the scenario impacted by the function, a period must be explicitly specified in the POVExpression parameter. Example For the example on the slide, if the current period is the last period in the year and the current year is not the last year in the application, the calculation status of the first period of the following year is impacted.

a r O

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

8-7

Module 3 Working With Data and Hierarchies Lesson 8 Working with Dimension Hierarchies

Managing Movement Accounts and Data Views


Parent accounts aggregate YTD values, even in periodic view. You can make the closing balance member a base member if you need to display balance sheet information in periodic view.

The parent member incorrectly uses the year-to-date values of movement accounts.

Copyright 2008, Oracle. All rights reserved.

Managing Movement Accounts and Data Views

To show balance sheet movement, custom dimensions typically contain a mix of balance and flow members: The member for the closing balance is a parent.

The members for opening balance and movement are children of the closing balance member. The movement members are flow members that show increases and decreases for the current period. Because the closing balance member is aggregated from its children, it does not need to be calculated by a rule.

a r O
8-8

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

Module 3 Working With Data and Hierarchies Lesson 8 Working with Dimension Hierarchies A limitation to this approach is that, when a hierarchy contains a mix of flow and balance accounts, the parent aggregates the year-to-date values of the account, even if the view is set to periodic. This aggregation can result in incorrect results being displayed in data grids and data forms. If you need to display balance sheet movement results in periodic views, you place the closing balance member at the hierarchy level of the opening and movement members. You can then use a rule to calculate the closing balance. The illustration on the slide shows a grid in periodic view. The Opening member is set by a rule to equal the ClosingBalance of the prior period. ClosingBalance is a parent member of a custom dimension. The values for ClosingBalance are aggregated from the values for Opening, Increases, and Decreases. Notice that the ClosingBalance member aggregates the year-to-date values of the Increase and Decrease members, rather than the current period values, and therefore shows an incorrect total. The Closing member is a base level member that is calculated using the following rules. HS.Exp "C4#Opening=C4#Closing.P#Prior" HS.Exp "C4#Closing=C4#Opening+C4#Increases-C4#Decreases" The Closing member correctly uses the periodic values.

To support display of balance sheet movement in year-to-date view, you can set the opening balance for all periods equal to the closing balance of the prior year: HS.Exp "C4#Opening=C4#Closing.Y#Prior.P#Last"

This provides a correct aggregation for closing balance when year-to-date values for movement member are displayed.

a r O

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

8-9

Module 3 Working With Data and Hierarchies Lesson 8 Working with Dimension Hierarchies

Avoiding Circular Calculations in Hierarchies


Child member calculations: May depend on parent values May result in circular calculations

HS.Clear "A#BSDifference" HS.Exp "A#BSDifference=A#CapitalEmployedA#Shareholders"


Copyright 2008, Oracle. All rights reserved.

Avoiding Circular Calculations in Hierarchies

If the source account in an account expression is a parent level account, its value is aggregated on-the-fly. If the destination is a child of the source account, its value is included in the aggregated parent value, resulting in a circular reference. Some common examples where circular references may occur are offset accounts for balance sheet differences and plug accounts for allocations. Whenever possible, you should define you hierarchies to avoid circular references. In situations where you cannot avoid rules with circular references, clear the child account by placing the HS.Clear function before the rule that includes the circular reference. The HS.Clear function clears data for a specified point of view. Syntax

a r O
8-10

HS.Clear "POVExpression" POVExpression identifies the members of the Account, ICP, and custom dimensions for which data should be cleared. Hyperion Financial Management 9.3.1: Create Rules

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Module 3 Working With Data and Hierarchies Lesson 8 Working with Dimension Hierarchies All members of omitted dimensions are cleared. You can use the ALL keyword with the Account dimension to clear all accounts. Example The following example clears the values for the Steel and Retail custom dimension members for all accounts: HS.Clear C2#Steel.C3#Retail

a r O

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

8-11

Module 3 Working With Data and Hierarchies Lesson 8 Working with Dimension Hierarchies

Creating Allocations Using Sub Allocate


Allocations redistribute data from an entity to a group of entities .
For example, you could allocate a lump sum total for heating expenses from the Facilities entity to a list of entities.

The Sub Allocate procedure enables you to run allocation rules separately from consolidations.
Facilities Marketing Development Sales Heating 60,000 20,000 20,000 20,000 Expenses Plug -60,000

Copyright 2008, Oracle. All rights reserved.

Creating Allocations Using Sub Allocate

To obtain correct results, you may need to calculate allocations separately from consolidations and other calculations. For example, you may need to perform this sequence of calculations: 1. Consolidate data to obtain a total for an expense at the parent level. 2. Run an allocation rule to distribute the expense to child entities. 3. Consolidate again to update the parents of the entities.

Placing allocation rules in the Sub Allocate procedure enables you to run them separately from consolidation and calculation rules.

a r O
8-12

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

Module 3 Working With Data and Hierarchies Lesson 8 Working with Dimension Hierarchies

Running the Sub Allocate Procedure


Rules in Sub Allocate: Update the Entity Currency member of the Value dimension only. Run only for members with a calculation status of OK. Impact parent calculation status.
Sub Allocate() dim vAllocAmount dim vAll_Nones vAll_Nones=".I#[ICP None].C1#[None].C2#[None].C3#[None].C4#[None]" If HS.Entity.IsBase("EastUS","") Then vAllocAmount=HS.GetCell("A#AdminExpenses.E#EastAdmin" &vAll_Nones) HS.Exp "A#AdminExpAlloc" &vAll_Nones& "="& _ vAllocAmount& "/HS.Entity.NumBase(EastUS)" End If If HS.Entity.Member="EastAdmin" Then HS.Exp "A#AdminExpPlug" &vALL_Nones&"="& -vAllocAmount End If End Sub
Copyright 2008, Oracle. All rights reserved.

Running the Sub Allocate Procedure

You can run a Sub Allocate procedure from the shortcut menu of a data grid or by calling it from another procedure, such as Sub Calculate. The following considerations apply to the Sub Allocate procedure: Sub Allocate runs only for members with a calculation status of OK. For Sub Allocate rules, Entity Currency is the only valid destination member of the Value dimension. When a Sub Allocate procedure runs for and modifies data of a child entity, the consolidation status of the parent entities is impacted.

a r O

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

8-13

Module 3 Working With Data and Hierarchies Lesson 8 Working with Dimension Hierarchies An allocation rule typically references a parent value, to determine the allocation percentage for each child entity. It also typically writes a reversing entry to a plug account, to ensure that allocated data is not counted twice. For the example on the slide, the NumBase function is used with the EastUS parent entity to retrieve the number of its base members. This number is then used to perform an even split of the data in the AdminExpense account of the EastAdmin entity between the base members of EastUS. A reversing entry for AdminExpense is written to a plug account for EastAdmin.

a r O
8-14

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

Module 3 Working With Data and Hierarchies Lesson 8 Working with Dimension Hierarchies

Using the Alloc Function to Create Allocation Rules


The Alloc function: Facilitates creating allocation rules Is valid only in the Sub Allocate procedure

Sub Allocate() call HS.ALLOC ("E#Admin.A#Rent","A#RentAlloc","US_Entities","& _ "A#Headcount/A#Headcount.E#UnitedStates","E#Admin.A#PLUG") End Sub

Copyright 2008, Oracle. All rights reserved.

Using the Alloc Function to Create Allocation Rules

You can use the Alloc function to allocate a value to a list of entities. The Alloc function is unique in that it can write values to multiple destination entities, rather than writing to only the current point of view entity. Syntax

HS.Alloc ("SourcePOV","DestPOV","EntityList","AllocExp","PlugAccount")

a r O

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

8-15

Module 3 Working With Data and Hierarchies Lesson 8 Working with Dimension Hierarchies
Parameter SourcePOV Description Source point of view for the data to be allocated. You must specify an Account member, and you can specify ICP and custom members. If you do not specify ICP and custom members: The default ICP member is [ICP Top]. The default custom member is the top member for the account. If you do not specify an entity, the current point of view entity is used. Destination point of view for the data to be allocated. You must specify an Account member, and you can specify ICP and custom members. Note the following usage rules: If you do not specify an ICP member, the default is [ICP None]. If you do not specify a custom member, the default is [None]. If you specify an Entity member and the EntityList parameter is [Base], the member is used as the parent. Member list that identifies the entities to which the data is to be allocated. You can use the system-defined entity list [Base] or a user-defined list. If you use the system-defined list [Base], the system uses the entity specified in the destination point of view as the parent member. If you use a user-defined list that contains parent members, the parent members are skipped.

DestPOV

EntityList

a r O
8-16

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

Module 3 Working With Data and Hierarchies Lesson 8 Working with Dimension Hierarchies
Parameter AllocExp Description Expression that yields a factor to use to determine the amount to allocate to each entity. The SourcePOV value is multiplied by this factor. This expression can contain the following types of values: Numbers Account expressions that identify a numeric value. You can specify an Account member, and you can specify members of the ICP and custom dimensions. Note the following usage rules: - If you do not specify a custom member, the default is <Top Member>. - If you do not specify an ICP member, the default is [ICP Top]. - If you do not specify Scenario, Year, Period, View, or Value members, the default is <Current>. - If you do not specify an Entity member, the default is the destination entity. Name of a plug account. This optional argument is used to reverse the source point-of-view amount, considering the attribute of the source pointof-view account versus the attribute of the plug account. You must specify an Account member, and you can specify ICP and custom members. Note the following usage rules: You cannot use this argument if the source point-of-view Entity member is a parent or the source point-of-view Value member is not <Entity Currency>. If you do not specify an ICP member, the default is [ICP None]. If you do not specify custom member, the default is [None].

PlugAccount

Example

For the example on the slide, the balance in the Rent account is allocated to the RentAlloc account for the members in the US_Entities member list. The allocation percentage is calculated by dividing the headcount of each member by the total headcount of the United States. A reversing entry for the Rent account is written to the Plug account.

a r O

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

8-17

Module 3 Working With Data and Hierarchies Lesson 8 Working with Dimension Hierarchies

Summary
In this lesson, you should have learned to: Work with the calendar Manage movement accounts and data views Avoid circular references in hierarchies Create allocations

a r O
8-18

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

M O D U L E

Creating Custom Translations and Consolidations

Overview
In this module, you learn to customize the default currency translation and consolidation calculations. Lessons in this module include: Creating Currency Translation Rules Creating Consolidation and Elimination Rules

a r O

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

a r O

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

L E S S O N

9
9

Creating Currency Translation Rules

Objectives
At the end of this lesson, you should be able to: Explain Financial Management currency translation Explain the default translation calculation Create rules using translation functions Calculate exchange differences Work with currency overrides

a r O

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Module 4 Creating Custom Translations and Consolidations Lesson 9 Creating Currency Translation Rules

About Translating Data

EUR

Entity Currency = EUR

USD
Europe

EntityA
Entity Currency Total = USD

Parent Currency = EUR

Copyright 2008, Oracle. All rights reserved.

About Translating Data

Currency translation converts account data from one currency to another. When you consolidate data, currency translation occurs if the parent entity has a different default currency than the child entities. Data in the Entity Currency Total member of the child is translated to the parents currency and the result is stored in the corresponding child currency member. For example, if EntityA has a default currency of USD and its parent, Europe, has a default currency of EUR, data in the Entity Currency Total member of EntityA is translated to EUR and is written to the EUR member of EntityA. The data in the EUR member of EntityA is then consolidated to the Entity Currency member of Europe.
NOTE

a r O
9-2

Translated values are never written to the Parent Currency member of the Value dimension. The Parent Currency member is a read-only member that displays the translated currency member of the child.

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

Module 4 Creating Custom Translations and Consolidations Lesson 9 Creating Currency Translation Rules

Currency and Exchange Rate Settings


Default currency for each entity Default currency for the application Exchange rates accounts for flow and balance accounts Translation method

Copyright 2008, Oracle. All rights reserved.

Currency and Exchange Rate Settings

The settings for the following properties determine the default translation behavior for the application.
Property DefCurrency Description

DefaultCurrency

a r O

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Specifies a default currency for each entity. During consolidation, the DefCurrency property of the child is compared to the DefCurrency property of the parent to determine whether translation is needed. Specifies the default currency for the entire application. This property is set in the Application Settings module.

Hyperion Financial Management 9.3.1: Create Rules

9-3

Module 4 Creating Custom Translations and Consolidations Lesson 9 Creating Currency Translation Rules
Property DefaultRateForBalance Description Specifies the account containing the exchange rates to use for Asset and Liability accounts. This property is set in the Application Settings module. Specifies the account containing the exchange rates to use for Income and Expense accounts. This property is set in the Application Settings module. Use the PVA translation method for all Asset and Liability accounts. This property is set in the Application Settings module. Use the PVA translation method for all Revenue and Expense accounts. This property is set in the Application Settings module.

DefaultRateForFlow

UsePVAForBalance

UsePVAForFlow

Exchange rates can be entered into the exchange rate accounts either at an individual entity or at the [None] entity. The system follows this sequence in determining the exchange rates to use: 1. The system looks in the current entity for an exchange rate.

2. If a rate is not found in the current entity, the system looks at the [None] entity for the rate. 3. If a rate is not found in the None entity, the system derives the rate by triangulation, using the application currency in the [None] entity. 4. If triangulation fails, the entity is not translated.

Triangulation is performed using the default application currency. For example, suppose that you are converting EURO to YEN, but the system cannot find an exchange rate to perform the translation. Assume that exchange rates to translate balances into USD exist for both the EURO and the YEN. Using triangulation, the system converts the EURO balance to USD and then converts the USD balance to YEN.

a r O
9-4

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

Module 4 Creating Custom Translations and Consolidations Lesson 9 Creating Currency Translation Rules

Translation Methods

The VAR method translates the entire balance at the current period rate. The Periodic Value Add (PVA) method: 1. Translates just the YTD change from the previous period at the current periods exchange rate. 2. Adds this to the previous month translated balance.
VAR Jan Exchange Rate Local Currency YTD Translated YTD 1:3 50 150 Feb 1:2 75 150 PVA Method Jan 1:3 50 150 Feb 1:2 75 200

75 50 = 25 X 2 50

Current period increase/decrease at current period rate plus prior period balance
Copyright 2008, Oracle. All rights reserved.

150 200

Translation Methods

Financial Management provides two translation methods. The value at rate (VAR) method translates the entire current period balance at the current period exchange rate. The periodic value add (PVA) method translates only the current month change in the YTD value at the current period exchange rate. It then adds the translation result to the balance from the previous period, translated at the exchange rate of the previous period. For the example on the slide, the January YTD balance in local currency is 50 and the exchange rate is 1:3. The YTD local currency balance for February is 75 and the exchange rate is 1:2. To determine the February translated value: The value at exchange rate method translates the entire February local currency balance (75) at the February exchange rate (1:2), for a translated balance of 150.

a r O

The PVA method calculates the change between the January and February local currency balance (25) and translates the change at the February rate (1:2), for a translated value of 50. It adds this result to the translated January balance (150), for a February translated balance of 200. 9-5

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

Module 4 Creating Custom Translations and Consolidations Lesson 9 Creating Currency Translation Rules You set the PVA method in the Application Settings module. You can set the PVA method for flow accounts, for balance accounts, or for both. If you do not set the PVA method, the VAR method is used.

a r O
9-6

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

Module 4 Creating Custom Translations and Consolidations Lesson 9 Creating Currency Translation Rules

Default Translation Process

Compare default currencies


DefCurrency Europe UnitedStates EUR USD

Europe April

1
Gross Sales Cash

Entity Currency 240 420

United States April


UsePVAForFlow UsePVAForBalance Yes No Gross Sales DefaultRateForFlow DefaultRateForBalance AvgRate EndRate AvgRate EndRate Entity Currenc y Total 200 300 April 1.2 1.4 Cash EUR 240 420

Copyright 2008, Oracle. All rights reserved.

Default Translation Process

The following steps describe the translation process during consolidation. 1. The DefCurrency property of the child being consolidated is compared to the DefCurrency property of the parent. If the currencies are different, translation is initiated. 2. The exchange rate account and translation method are selected based on the account type: For Revenue and Expense accounts, the rate account specified by the DefaultRateForFlow property is used. If PVAForFlow is enabled, the PVA method is selected; otherwise the VAR method is selected.

a r O

For Asset and Liability accounts, the rate account specified by the DefaultRateForBalance property is used. If PVAForBalance is enabled, the PVA method is selected; otherwise the VAR method is selected.

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

9-7

Module 4 Creating Custom Translations and Consolidations Lesson 9 Creating Currency Translation Rules 3. The value in the Entity Currency Total member is translated using the selected rate account and translation method. The result is stored in the Value dimension currency member that corresponds to the parents default currency. 4. The translated value is consolidated to the Entity Currency member of the parent. DefaultRateForFlow, DefaultRateForBalance, UsePVAForFlow, and UsePVAForFlow are application-wide settings that apply to all accounts. Custom translation rules are frequently used to override these settings. For example, you might create a custom translation rule to use a historical rate for some balance sheet accounts but not for others.

a r O
9-8

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

Module 4 Creating Custom Translations and Consolidations Lesson 9 Creating Currency Translation Rules

Creating Custom Translation Rules



Source currency member: Entity Currency Total. Destination currency member: Current point of view or parent default currency.

Sub Translate() .... .... End Sub

Rules in Sub Translate execute during consolidation. They can also be run from a Data Grid or Data Form

Sub Calculate() If HS.Value.IsTransCur Then ... ... End If End Sub


Rules in this section of Sub Calculate execute only on translated values.

Copyright 2008, Oracle. All rights reserved.

Creating Custom Translation Rules

You use translation rules to perform calculations on nonstandard translations. You place translation rules in the Sub Translate procedure. If you add a translation rule for an account to the Sub Translate procedure, the translation rule overrides the default translation for the account. All accounts for which rules do not exist in the Sub Translate procedure are translated using the default translation. Although you can perform other calculations in the Sub Translate procedure, it is typically used only for translations. Because the Sub Calculate procedure runs automatically after the Sub Translate procedure, you can place any calculations on the translated data in the Sub Calculate procedure.

a r O

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

9-9

Module 4 Creating Custom Translations and Consolidations Lesson 9 Creating Currency Translation Rules You can use a conditional statement with the IsTransCurr function to create a section in Sub Calculate that runs only for translated data. If the current Value dimension member is a translated currency, IsTranCurr function returns a value of TRUE. For rules within the Translation procedure, the default source member for the value dimension is Entity Curr Total. The destination member for the Value dimension is always the default currency member of the parent currency if the translation occurs during a consolidation or the currently select point of view member if the translation is run from a data grid. Data is translated using the default exchange rate accounts define in the Application Setting module, unless you override the defaults using a translation function. For example, if you use an HS.Exp expression in the Sub Translate procedure, the source data is automatically translated using the default exchange rate account when it is written to the destination.

a r O
9-10

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

Module 4 Creating Custom Translations and Consolidations Lesson 9 Creating Currency Translation Rules

Translation Functions
Two translation functions are available,Trans and Transperiodic:
Trans translates using the VAR method Transperiodic translated using the PVA method

Using translation functions, you can:


Specify the translation method Specify the exchange rate account Specify source and destination accounts Calculate differences due to exchange rates

HS.Trans "C1#Movement","","A#AvgRate","" HS.TransPeriodic "A#SaleForecast","A#Sales","A#ForecastRate",""

Copyright 2008, Oracle. All rights reserved.

Translation Functions

You use the Trans and Transperiodic functions to override the default translations for an account. The parameters for the two functions are identical. The only difference between the functions is the translation method used.

a r O

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

9-11

Module 4 Creating Custom Translations and Consolidations Lesson 9 Creating Currency Translation Rules Syntax HS.Trans "DestPOV","SourcePOV","Rate1","Rate2" HS.Transperiodic "DestPOV","SourcePOV","Rate1","Rate2"
Parameter DestPOV Description The destination point of view. The destination can be any combination of Account, Custom1...4, or ICP members. For each unspecified dimension, the system writes to all valid members of the dimension. For each specified dimension, the system writes to the specified member only. The source point of view. The source can be any combination of dimensions. If the Account, Custom1...4, and ICP dimensions are unspecified, the system uses the same member as the Destination member. If the Scenario, Year, Period, and Entity dimensions are not specified, the system uses the current members. If the Value dimension is not specified, the system uses the Entity Curr Total member. If SourcePOV is left blank, the system uses the destination point of view as the source point of view. The exchange rate. The rate can be a constant, an exchange rate account, or a specific cell. An exchange rate to use for calculating an exchange variance.

SourcePOV

Rate1 Rate2

Remarks The source Value dimension member is always Entity Curr Total. The destination Value dimension member is always the parent member when Sub Translate runs during consolidation or the current point of view currency member if Sub Translate is run from a data grid or a data form.

If the same destination point of view is used in multiple rules with Trans or Transperiodic, the results accumulate in the destination account. Results do not accumulate between the Trans and Transperiodic functions, however. For example, if a rules that uses the TRANS functions writes to a destination account that was previously written to by a rule using the Transperiodic function, the previous result is overwritten. Examples For the first example on the slide, the Movement member of the Custom1 dimension is translated using the rates in the AvgRate account. Because no account member is specified for the SourcePOV parameter, the rule is executed for all accounts for which the Movement member is valid.

a r O
9-12

For the second example on the slide, the source and destination account are different. The source account, Sales, is translated using the exchange rates in the ForecastRate account. The translated data is written to the destination account, SalesForecast. Hyperion Financial Management 9.3.1: Create Rules

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Module 4 Creating Custom Translations and Consolidations Lesson 9 Creating Currency Translation Rules

Calculating Exchange Differences


Jan Jan Closing Rate Feb Closing Rate 1.2 1.4 Cash - Entity Currency Total Cash -EUR 500 600 Feb 500 700

Difference of 100 is due to exchange rates.

HS.Trans "A#Cash.C1#FXO","A#Cash.C1#Opening","A#EndRate","A#OpenRate"

(Cash x EndRate) - (Cash x OpenRate) = 700 - 600 = 100


OpenRate EndRate 1.2 1.4 FXO Entity Currency EUR 100

Copyright 2008, Oracle. All rights reserved.

Calculating Exchange Differences

When currency translation take place, changes in account balances are frequently due solely to fluctuations in exchange rates. For the example on the slide, the balance of 500 for Cash is unchanged between January and February for the local currency. The translated values, however, show an increase of 100 for Cash in February. Examining the exchange rates shows that the increase stems from a difference in the rates for January and February.

a r O

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

9-13

Module 4 Creating Custom Translations and Consolidations Lesson 9 Creating Currency Translation Rules You can use the translation functions to calculate differences due to exchange rates. If you include a second exchange rate account in the Rate2 parameter of the Trans or Transperiodic function, the following calculation is performed: 1. The source account is translated using the exchange rate account specified in the Rate1 parameter. 2. The source account is translated using the exchange rate account specified in the Rate2 parameter. 3. The difference between the result calculated using Rate1 and the result calculated using Rate2 is written to the destination account. The slide example shows a rule to calculate the effect of exchange rates on the opening balance for Cash. For balance sheet accounts, data is typically translated at the current period end rate. Opening values, however, are taken from the prior period and therefore should be translated at the prior period end rate. For the example on the slide, the value for the Opening member for Cash is translated using both the EndRate account and the OpenRate account. The OpenRate account contains the prior period exchange rates. The translation difference is written to an adjustment member in the Custom1 dimension, FXO. You can also take advantage of the cumulative nature of the translation functions to accumulate adjustments to a single currency translation adjustment account. In the following example, balance sheet accounts with the user defined attribute HIST are translated at a historical rate. Exchange differences for these accounts are accumulated into the CTA account.

dHistRate = HS.GetRate("A#HistRate") dBSRate = HS.GetRate("A#BSRate") sBSAccts = HS.Account.List("BALANCESHEET","[Base]") For Each sBSAcct In sBSAccts If UCase(HS.Account.UD2(sBSAcct)) = "HIST" Then HS.Trans "A#" & sBSAcct, "", dHistRate, "" HS.Trans "A#CTA", "A#" & sBSAcct, dHistRate, dBSRate End If Next
TIP

a r O
9-14

Note the use of the GetRate function in the previous example. The GetRate function retrieves the exchange rate for a specified rate account and point of view. If no point of view is specifed, the current point of view is used.

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

Module 4 Creating Custom Translations and Consolidations Lesson 9 Creating Currency Translation Rules

Working with Currency Overrides

Sub Translate() If HS.GetCell("A#PaidInCap_USD")<>0 Then HS.EXP "A#PaidInCap=A#PaidInCap_USD" Else HS.EXP "A#PaidInCap = P#Last.Y#Prior" End If End Sub

Copyright 2008, Oracle. All rights reserved.

Working with Currency Overrides

Some balance sheet accounts have static data that rarely changes, for example, paid-in capital. For these accounts, it is sometimes more efficient to use already translated historical data than to translate values each period. This is called a currency override. When you use currency overrides, you load the translated historical values to the Entity Currency member of a statistical account. Typically you use an account type of Balance or Balance Recurring. Data for these account types does not get translated. During translation, you retrieve the already translated historical values from the statistical account instead of translating the local currency data. Because you do not need to translate the data, you can use the HS.Exp function to pull the values.

a r O

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

9-15

Module 4 Creating Custom Translations and Consolidations Lesson 9 Creating Currency Translation Rules For the example on the slide, the PaidInCapital_USD account contains translated historical USD values for the PaidInCapital account. It is a Balance Recurring account, so it does not get translated. The GetCell function verifies that there is data in the Entity Currency member of PaidInCapital_USD for the current period: If there is a value for the current period, it is copied to the USD currency member for PaidInCapital. If there is no value for the current period, the closing value from the previous year for PaidInCapital is used. It will be translated using the default rate account .

a r O
9-16

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

Module 4 Creating Custom Translations and Consolidations Lesson 9 Creating Currency Translation Rules

Summary
In this lesson, you should have learned to: Explain Financial Management currency translation Explain the default translation calculation Create rules using translation functions Calculate exchange differences Work with currency overrides

a r O

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

9-17

Module 4 Creating Custom Translations and Consolidations Lesson 9 Creating Currency Translation Rules

a r O
9-18

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

L E S S O N

1 0

Creating Consolidation and Elimination Rules

10

Objectives
At the end of this lesson, you should be able to: Explain the default consolidation calculation Create consolidation rules Create elimination rules

a r O

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Module 4 Creating Custom Translations and Consolidations Lesson 10 Creating Consolidation and Elimination Rules

Default Consolidation Calculations


Entity Currency of Parent = Proportion + Elimination + Contribution Adjs

Input through journals

If Interco, then -(Parent total x PCON) Parent total x PCON


IsIcp PlugAcct ICP Yes IC_Plug EntityA

Copyright 2008, Oracle. All rights reserved.

Default Consolidation Calculations

Consolidation is the process of gathering data from child entities and aggregating the data to parent entities. When you run a consolidation, each childs contribution to the parent is derived by using the default application calculations, and the results are written to the Entity Currency member of the parent. The following steps describe the procedure that Financial Management uses to calculate the childs contribution to the parent for each account: 1. Check the IsConsolidated property of the account to verify that it should be consolidated. 2. Apply the consolidation percentage in the PCON account to the data in the Parent Total member. The Parent Total member is the sum of the Parent Curr Total and Parent Curr Adjs members. If there is no data in the PCON account, use 100 percent.

a r O
10-2

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

Module 4 Creating Custom Translations and Consolidations Lesson 10 Creating Consolidation and Elimination Rules 3. Write the result to the Proportion member of the Value dimension. 4. Run the Sub Calculate procedure for the Proportion member. 5. Determine whether an intercompany elimination is required. These four criteria must be met: The IsICP property of the account is selected. The PlugAcct property of the account specifies a plug account. The ICP member of the Value dimension specifies an intercompany partner. The specified Intercompany partner is a descendant of the current parent. 6. If the criteria listed in step 5 are met, perform the elimination: Write a reversing entry for the data in the Proportion member to the Elimination member. Write an entry for the data in the Proportion member to the Elimination member of the Plug account. 7. Run Sub Calculate for the Elimination member. 8. Run Sub Calculate for the Contribution Adjs member.

9. Write the sum of the Proportion, Elimination, and Contribution Adjs members of the child to the Entity Currency member of the parent.

a r O

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

10-3

Module 4 Creating Custom Translations and Consolidations Lesson 10 Creating Consolidation and Elimination Rules

Creating Consolidation Rules


To create consolidation rules: Enable the ConsolidationRules option. Add Sub Consolidate to the rules file.
!APPLICATION_SETTINGS DefaultCurrency=USD UsePVAForBalanceAccounts=N UsePVAForFlowAccounts=N ConsolidationRules=Y OrgByPeriodApplication=N NodeSecurity=Entity Sub Consolidate() ... ... End Sub

Copyright 2008, Oracle. All rights reserved.

Creating Consolidation Rules

You can override the default consolidation calculations by creating your own consolidation rules. To use consolidation rules, you must enable the ConsolidationRules option in the Application Settings module. When the ConsolidationRules option is enabled, the default consolidation calculations are disabled. You must create a Sub Consolidate procedure in the rules file with the necessary rules for consolidation. Accounts for which you do not include rules in the Sub Consolidate procedure do not get consolidated. You create consolidation rules to derive the values for the Proportion and Elimination members of the value dimension. The aggregation of the Proportion, Elimination, and Contribution Adjs members to the Entity Currency member of the parent takes place automatically, even when the ConsolidationRules option is enabled.

a r O
10-4

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

Module 4 Creating Custom Translations and Consolidations Lesson 10 Creating Consolidation and Elimination Rules

Consolidation Functions
PCon retrieves the consolidation percentage. Con updates the Proportion and Elimination members.
The source is the Parent Total member for the current entity, year, and scenario. The destination is either the Proportion or the Elimination member.

HS.Parent Member returns the current parent member label.


Example 1

vPCon=HS.Node.PCon("") HS.Con "", vPCon, ""


Example 2

HS.Con "V#[Elimination]",-1, ""

Copyright 2008, Oracle. All rights reserved.

Consolidation Functions

The following sections describe functions that are commonly used in consolidation rules. PCon The PCon function retrieves the consolidation percentage from the PCON system account for a specified parent and child. It is used with the HS.Node object. Syntax

HS.Node.PCon("S#Scenario.Y#Year.P#Period.E#Parent.Child")

a r O

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

10-5

Module 4 Creating Custom Translations and Consolidations Lesson 10 Creating Consolidation and Elimination Rules Parameters Scenario, Year, Period Specifies the point of view for which to retrieve the consolidation percentage. If a dimension is omitted, the value from the current point of view is used. Parent, Child The parent and child for which to retrieve the consolidation percentage. If this parameter is omitted, the current parent and child are used. Con The Con function multiplies the value of the Parent Total member by a specified factor and updates either the Proportion member or the Elimination member of the Value dimension with the result. This function is valid only in the Sub Consolidate procedure.

a r O
10-6

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

Module 4 Creating Custom Translations and Consolidations Lesson 10 Creating Consolidation and Elimination Rules Syntax HS.Con "DestinationPOV", Factor, "Nature"
Parameter DestinationPOV Description Any combination of members for the following dimensions: Account Intercompany Custom1...4 Entity Value Valid destination members for the Value dimension are Proportion and Elimination. If no value dimension member is specified, the Proportion member is used as the destination. Factor A factor by which to multiply the data in the Parent Total member. This factor can be a constant, a function, or an expression using mathematical operators (+ - * /). The PCon function is typically used to specify the factor. A text string used for audit purposes. This string is stored and provides information about the accounting purpose of the transaction. To allow users to view consolidation source and destination transaction detail after running a consolidation, you must include text in this parameter. If you do not include text, the transaction detail is not stored.

Nature

Remarks

You cannot specify a source for the Con function. The source is always the Parent Total member of the Value dimension for the current scenario, year, period, and entity. The Con function is used in conjunction with the OpenDataUnit function, and the source account for Con is always the account for the current item in the data unit. You can specify a destination account. If the destination account has a different debit/credit attribute from the source account, the system reverses the sign in the destination. For example, if the source is a Revenue account and the destination is an Expense account, the sign is reversed. Examples

a r O

For example 1 on the slide, the Parent Total member is multiplied by the value returned by the PCon function. If there is no data in the PCON account for the current point of view, a default of 100 percent is used. Because no destination point of view is specified, the Proportion member, which is the default destination member, is updated with the result.

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

10-7

Module 4 Creating Custom Translations and Consolidations Lesson 10 Creating Consolidation and Elimination Rules If you are not using consolidation percentages in your application, you can use a factor of 1 to consolidate all children at 100 percent, as in the following example: HS.Con "", 1, "" For the second example on the slide, the Elimination member is specified as the destination. Because this is a reversing entry, a factor of -1 is used. HS.Parent.Member The HS.Parent.Member function returns the parent of the current entity. This function does not have any parameters. Examples The following example stores the current parent in a variable: vParent=HS.Parent.Member

a r O
10-8

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

Module 4 Creating Custom Translations and Consolidations Lesson 10 Creating Consolidation and Elimination Rules

Consolidation Procedure Example


Sub Consolidate() Set ConsUnit = HS.OpenDataUnit("") NumItems = ConsUnit.GetNumItems For i = 0 to NumItems -1 Call ConsUnit.GetItem(i, vAcc, vICP, vC1, vC2, vC3, vC4, vData) If HS.Account.IsConsolidated(vAcc) And vData <> 0 Then HS.Con "", HS.Node.PCon(""), "" vPlug = HS.Account.PlugAcct(vAcc) If CanEliminate(vPlug,vICP)= True Then HS.Con "V#[Elimination]", -HS.Node.PCon(""), "" HS.Con "A#" &vPlug& ".V#[Elimination]", HS.Node.PCon(""), "" End If End If Next End Sub

1 2 3 4 5 6 7 8

Copyright 2008, Oracle. All rights reserved.

Consolidation Procedure Example

When you create a consolidation procedure, you typically first create rules to perform the default consolidation calculations. You then modify the default calculations for those entities or accounts that need special treatment. The example on the slide shows a Sub Consolidate procedure that includes rules to perform the default consolidation and elimination calculations. The following steps explain the example procedure: 1. Opens a data unit for the current point of view and stores it in the ConsUnit variable. ConsUnit contains records for all accounts that have data for the current entity, scenario, year, and period. 2. Creates a For...Next loop to loop through each item in ConsUnit.

a r O

3. Uses the GetItem function to retrieve an item from ConsUnit. The account is stored in the variable vAcc and the intercompany partner is stored in vICP.

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

10-9

Module 4 Creating Custom Translations and Consolidations Lesson 10 Creating Consolidation and Elimination Rules 4. Verifies that the IsConsolidate property is TRUE for the current account and that it does not contain a zero. If these conditions are not met, the rest of the procedure is skipped. 5. Uses the Con function to derive the value for the Proportion member: The HS.Node.Pcon("") function retrieves the consolidation percentage for the current child to use as the multiplication factor. Because the destination parameter of HS.Con is blank, the result is written to the default destination, which is the Proportion member. 6. Retrieves the plug account for the current account and stores it in the vPlug variable. The vAcct variable from the GetItem function is used to specify the current account. The vPlug variable is used in a later step as part of the intercompany elimination. 7. Calls the CanEliminate custom function. This function returns a value of TRUE if the account requires an intercompany elimination. This function is explained in a later topic. 8. If the CanEliminate function returns a value of TRUE:

The Con function is used to write a reversing entry to the Elimination member. To create the reversing entry, the Elimination member is specified as the destination, and the sign for the consolidation percentage is reversed. The elimination amount is written to the Elimination member of the plug account.

a r O
10-10

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

Module 4 Creating Custom Translations and Consolidations Lesson 10 Creating Consolidation and Elimination Rules

Testing for Eliminations


Function CanEliminate(vPlug, vICP) vPar=HS.Parent.Member CanEliminate = TRUE If vPlug="" Then CanEliminate=FALSE ElseIf vICP="[ICP None]" Then CanEliminate=FALSE ElseIf Not HS.Entity.IsDescendant(vPar, vICP) Then CanEliminate=FALSE End If End Function

1 2

Copyright 2008, Oracle. All rights reserved.

Testing for Eliminations

Data that require intercompany elimination must meet the following criteria: The account must be an intercompany account. A plug account must be specified.

There must be an intercompany partner.

The intercompany partner must be a descendant of the current parent. Although you can include rules for these tests in the Sub Consolidate procedure, it is common to create a custom function for this purpose.

a r O

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

10-11

Module 4 Creating Custom Translations and Consolidations Lesson 10 Creating Consolidation and Elimination Rules The example on the slide shows a custom function named CanEliminate that returns a value of TRUE if the criteria are met. The intercompany partner and the plug account are passed as variables from the Sub Consolidate procedure. 1. The parent member is retrieved and is stored in the vPar variable. The vPar variable is used in a later step to verify that the intercompany partner is a descendant of the current parent. 2. The value for the CanEliminate variable is set to an initial state of TRUE. 3. An If...Then...Else statement is used to test for each of the criteria. If a criterion is not met, the CanEliminate variable is set to FALSE. Otherwise the CanEliminate variable remains set to TRUE. The first condition verifies that the accounts PlugAcct property is not empty. The second condition verifies that an intercompany partner is selected in the ICP dimension. At the same time, this condition verifies that the account is an intercompany account. The third condition verifies that the intercompany partner is a descendant of the current parent member. Explain the default consolidation calculation Create consolidation rules Create elimination rules

a r O
10-12

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

Module 4 Creating Custom Translations and Consolidations Lesson 10 Creating Consolidation and Elimination Rules

Summary
In this lesson, you should have learned to: Explain the default consolidation calculation Create consolidation rules Create elimination rules

a r O

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

10-13

Module 4 Creating Custom Translations and Consolidations Lesson 10 Creating Consolidation and Elimination Rules

a r O
10-14

e l c

e l c a r O ly & On l a e n r s e t U n I

c A

e d a

y m

Hyperion Financial Management 9.3.1: Create Rules

You might also like