Sie sind auf Seite 1von 44

Hyperion

Financial Management 9.3.1


Create Rules
m y
Activity Guide

d e
ca
e A
c l
r a
O ly
l & On
D52786GC10

n a e
Edition 1.0
January 2008

t e r U s
D53156

I n
c l e ®

r a
O
Author Copyright © 2008, Oracle. All rights reserved.

Mark Mitsock Disclaimer

This document contains proprietary information and is protected by copyright and


Technical Contributors other intellectual property laws. You may copy and print this document solely for your
and Reviewers 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
Keith Glide 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
Jennifer Hough express authorization of Oracle.
Daniel Tijerina
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,
Editor 500 Oracle Parkway, Redwood Shores, California 94065 USA. This document is not
warranted to be error-free.
Susan Moxley
Restricted Rights Notice
Graphic Designer 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
Carisa Cannan applicable:

U.S. GOVERNMENT RIGHTS


Publisher The U.S. Government’s rights to use, modify, reproduce, release, perform, display, or
Judy Gaitan 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.

m y
d e
c a
e A
c l
r a
O ly
l & On
n a e
t e r U s
I n
c l e
r a
O
Table of Contents 0

Exercises

Lesson 1: Reviewing Rules Syntax


Exercise 1.1 Find the errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

Lesson 2: Creating Variables


Exercise 2.1 Creating Constants for the Custom and ICP Dimensions . . . . . . . . . . . . 3
Exercise 2.2 Creating Header Variables for Sub Calculate . . . . . . . . . . . . . . . . . . . . . 3
Creating Point of View Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
Creating Variables for Base Entities and Translated Currencies . . . . . . . . . . . . . . . 4

Lesson 3: Controlling the Scope of Rules


Exercise 3.1 Creating Variables for the Total Members . . . . . . . . . . . . . . . . . . . . . . . . 5
Exercise 3.2 Setting the Scope of the Rule . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
m y
Exercise 3.3 Working with Custom Dimensions in Rules . . . . . . . . . . . . . . . . . . . . . . . 5
d e
Creating a Rule to Calculate Discounts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

c a
Testing the Discounts Rules. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

A
Transferring Data from the Income Statement to the Balance Sheet. . . . . . . . . . . . 7

e
Lesson 4: Creating Dynamic Rules
c l
Exercise 4.1
Exercise 4.2 r a
Creating a Percent of Sales Calculation for the Periodic View . . . . . . . . 9
Creating a Gross Margin Calculation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
O ly
Lesson 5: & On
Creating Custom Procedures
l
Exercise 5.1 a e
Creating a Custom Sub Procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
n
Exercise 5.2
Exercise 5.3
t e r U s
Creating a Custom Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Creating a Custom Logging Procedure . . . . . . . . . . . . . . . . . . . . . . . . . 11

Lesson 6: I n
Creating Arrays and Loops

c
Exercise 6.1l e Creating Loops with Member Lists . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12

r a
Exercise 6.2 Working with Data Units . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

O
Table of Contents

Lesson 7: Working with Financial Management Data


Exercise 7.1 Retrieving Data With the GetCell Function . . . . . . . . . . . . . . . . . . . . . . 14
Exercise 7.2 Applying Rounding to Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Exercise 7.3 Creating a NoInput Procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15

Lesson 8: Working with Dimension Hierarchies


Exercise 8.1 Calculating Closing Balances. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Exercise 8.2 Managing Calculation Status . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Exercise 8.3 Setting Opening Balances . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Exercise 8.4 Creating an Allocation (Optional) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17

Lesson 9: Creating Translation Rules


Exercise 9.1 Creating Translation Rules. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
Calculating Exchange Differences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
Calculating the Currency Translation Adjustment . . . . . . . . . . . . . . . . . . . . . . . . . 21

Lesson 10: Creating Consolidation Rules


Exercise 10.1 Customizing the Default Consolidation . . . . . . . . . . . . . . . . . . . . . . . . . 22
m y
d e
Exercise Solutions
c a
Lesson 1: Reviewing Rules Syntax
e A
Solution 1.1
c l
Find the Errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24

r a
Lesson 2: Creating Variables
O ly
Solution 2.1
& On
Creating Constants for the Custom and ICP Dimensions . . . . . . . . . . . 25
l
Solution 2.2
a e
Creating Header Variables for Sub Calculate . . . . . . . . . . . . . . . . . . . . 25

n
Lesson 3: r s
Controlling the Scope of Rules
t e U
Solution 3.1
Solution 3.2 I n
Creating Variables for the Total Members . . . . . . . . . . . . . . . . . . . . . . . 26
Setting the Scope of the Rule . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26

l
Solution 3.3
c e Working with Custom Dimensions in Rules . . . . . . . . . . . . . . . . . . . . . . 26

r a
O
iv Hyperion Financial Management 9.3.1: Create Rules
Table of Contents

Lesson 4: Creating Dynamic Rules


Solution 4.1 Creating a Percent of Sales Calculation for the Periodic View . . . . . . . 28
Solution 4.2 Creating a Gross Margin Calculation . . . . . . . . . . . . . . . . . . . . . . . . . . . 28

Lesson 5: Creating Custom Procedures


Solution 5.1 Creating a Custom Sub Procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
Solution 5.2 Creating a Custom Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
Solution 5.3 Creating a Custom Logging Procedure . . . . . . . . . . . . . . . . . . . . . . . . . 30

Lesson 6: Creating Arrays and Loops


Solution 6.1 Creating Loops with Member Lists . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
Solution 6.2 Working with Data Units . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32

Lesson 7: Managing Financial Management Data


Solution 7.1 Retrieving Data With the GetCell Function . . . . . . . . . . . . . . . . . . . . . . 33
Solution 7.2 Appying Rounding to Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
Solution 7.3
y
Creating a NoInput Procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34

m
Lesson 8: Working with Dimension Hierarchies
d e
Solution 8.1
Solution 8.2 c a
Calculating Closing Balances. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
Managing Calculation Status . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
Solution 8.3 A
Setting Opening Balances . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35

e
Solution 8.4
l
Creating an Allocation (Optional) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36

c
Lesson 9:
r a
Creating Translation Rules
Solution 9.1 O ly
Creating Translation Rules. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37

l & On
Lesson 10: Creating Consolidation Rules

n a e
t e r U s
Solution 10.1 Customizing the Default Consolidation . . . . . . . . . . . . . . . . . . . . . . . . . 38

I n
c l e
r a
O
Hyperion Financial Management 9.3.1: Create Rules v
Table of Contents

m y
d e
c a
e A
c l
r a
O ly
l & On
n a e
t e r U s
I n
c l e
r a
O
vi Hyperion Financial Management 9.3.1: Create Rules
Exercises

Overview
This section contains hands-on exercises that you will be working on
throughout this course. Exercises are grouped by lesson.
Your instructor may choose to demonstrate some exercises. Therefore,
you may not be required to complete all exercises. It is, however, important
that you complete all exercises as requested by the instructor, as many
exercises build upon one another in the course.

m y
d e
c a
e A
c l
r a
O ly
l & On
n a e
t e r U s
I n
c l e
r a
O
Lesson 1 Reviewing Rules Syntax
Exercises

Lesson 1 Reviewing Rules Syntax

Exercise 1.1 Find the errors


Identify 7 syntax mistakes in the following rules:
If HS.Scenario.Member="Budget"
HS.Exp "A#Sales=AUnitsSold * A#Price"
Else
HS.Exp "A#Price=A#Sales / A#UnitsSold
EndIf
If HS.Value.Member="Entity Currency" Then
HS.Exp "A#Taxes=A#IncomeBeforeTaxesC1#Allcustom1.” _
“C2#Allcustom2.C3#Allcustom3.C4#Allcustom4.I#[ICP Top]*A#TaxRate/100"
End if

m y
d e
c a
e A
c l
r a
O ly
l & On
n a e
t e r U s
I n
c l e
r a
O
2 Hyperion Financial Management 9.3.1: Create Rules
Lesson 2 Creating Variables
Exercises

Lesson 2 Creating Variables

Exercise 2.1 Creating Constants for the Custom and ICP


Dimensions
In this exercise you create constants that you can use to specify frequently used
combinations of custom dimension and ICP members in function parameters. Because
the Apex application does not use the Custom4 dimension, you can omit it from the
constants. Before starting, you should decide on a convention for identifying variables
and constants. For example, you could use “pov_” as a prefix for variables that store the
current point of view and “v” as a prefix for all other variables and constants.

Start a new rules file named Apex2.rle. Create constants for the following combinations
of members:

• All custom dimensions and the ICP dimension set to the None member. You
do not need to include Custom4 because it is not used in the application.

• All custom dimensions and the ICP dimension set to the top member. You do
not need to include Custom4.
m y
• Custom 2, Custom 3, and the ICP dimension set to None, Custom 1 omitted
d e
c a
• Custom 1, Custom 2, and the ICP dimension set to None, Custom 3 omitted

A
• Custom 2, Custom 3, and the ICP dimension set to the top member, Custom
e
1 omitted
c l
r a
• Custom 1, Custom 3, and the ICP dimension set to the top member, Custom
2 omitted
O ly
3 omitted
l & On
• Custom 1, Custom 2, and the ICP dimension set to the top member, Custom

n a e
t e
syntax for Solution 2.1. r
Save the file as c:\cf\Apex\apex2.rle. When you are finished, compare your syntax to the

U s
I n
l e
Exercise 2.2
c
Creating Header Variables for Sub Calculate

r a
In this exercise you create variables that you can use throughout the Sub Calculate
procedure.

O
Hyperion Financial Management 9.3.1: Create Rules 3
Lesson 2 Creating Variables
Exercises

Creating Point of View Variables


In the Apex2.rle file, create a Sub Calculate procedure. Within the Sub Calculate
procedure, create a variables header section that stores the current point of view
members for these dimensions:
• Entity
• Scenario
• Value
• Year
• Period (store the period number, not the label)

Creating Variables for Base Entities and Translated Currencies


Using the IsBase function, create a variable that identifies whether the current point of
view entity is a base member.
Using the IsTransCur function, create a variable that identifies whether the current point
of view value member is a translated currency.
y
Save the file as c:\cf\Apex\apex2.rle. After you create the variables, compare your syntax
m
to the syntax for Solution 2.2.

d e
c a
e A
c l
r a
O ly
l & On
n a e
t e r U s
I n
c l e
r a
O
4 Hyperion Financial Management 9.3.1: Create Rules
Lesson 3 Controlling the Scope of Rules
Exercises

Lesson 3 Controlling the Scope of Rules

Exercise 3.1 Creating Variables for the Total Members


In this exercise you use a conditional statement to set a variable to the Entity Curr Total,
the Parent Curr Total, or the Contribution total member based on the current value
dimension member in the point of view.
Open the Apex2.rle file and save the file as Apex3.rle
Use an If…ElseIf statement to create a variable named vRight_value to store the value
member to use on the right side of the HS.Exp expression. Here are the requirements:
• If the current point of view member for the Value dimension is Entity Currency, set
vRight_Value to “.V#<Entity Currency Total>”
• If the current point of view member for the Value dimension is a translated currency
member, set vRight_value to HS.Value.Currency & “ Total”
• If the current point of view member for the Value dimension is Proportion, set
vRight_value to “V#[Contribution Total]”

m
After you have created the variables, compare your syntax to the syntax in Solution 3.1.
y
d e
Exercise 3.2 Setting the Scope of the Rule
c a
A
In this exercise you create a section in the Sub Calculate procedure for rules that should
e
c l
be executed only if the current entity is a base-level entity and the current Value
dimension member is the Entity Currency member.

r a
Create an If...Then statement in which to place rules to be executed only for the Entity
O ly
Currency member. Within this statement, create another If...Then statement in which to

& On
place rules to be executed only for base-level entities.

l
a e
When you are finished, compare your syntax to the syntax in Solution 3.2.

n
Exercise 3.3 t e r U s
Working with Custom Dimensions in Rules
I n
In this exercise you create rules to calculate the Discounts account and to transfer

l e
balances from the profit and loss statement to the balance sheet. Be sure to analyze the
c
custom dimensions settings for each account to determine the correct custom dimension

r a
members for each side of the HS.Exp expression.

O
Hyperion Financial Management 9.3.1: Create Rules 5
Lesson 3 Controlling the Scope of Rules
Exercises

The following rules are for base-level entities only and should be executed only for the
Entity Currency member.

Creating a Rule to Calculate Discounts


For budgeting purposes, Apex Corporation calculates the Discounts account as a
percentage of gross sales.

A fixed discount rate is used for each type of customer. These are the discount rates for
each customer type:
C_Trade: 5%
C_ Wholesale:15%
C_Retail: 6%
C_Other: 5%

m
Create the necessary rules for the Discounts account to calculate the total discount for
y
each customer type. Keep these considerations in mind:
d e
c a
• Because Apex makes adjustments to the budget by using journals during the course
of the year, you should base your calculation on the adjusted GrossSales account.

e A
• For the Actual scenario, Apex loads data for Discounts, so the Actual scenario should
be excluded from the calculation.
c l
r a
• Although gross sales are budgeted by customer and product, discounts are
budgeted by customer only. For this reason the Custom2 and Custom3 dimensions
O ly
are valid for the GrossSales account, but only the Custom3 dimension is valid for the
Discounts account.
l & On
a e
Before you write the rule, open Apex.xml in the Metadata Manager and review the

n
t e r
custom dimension settings for the Discounts and GrossSales accounts.

U s
n
Testing the Discounts Rules
I
l e
To test the rules, use the Net Sales grid. Set the point of view to West Sales, 2006,
February and run the rules. The C_Trade and C_Wholesale members have journal
c
r a
adjustments to GrossSales for February. Verify that the discount calculation uses the
adjusted totals for GrossSales.

O
6 Hyperion Financial Management 9.3.1: Create Rules
Lesson 3 Controlling the Scope of Rules
Exercises

Transferring Data from the Income Statement to the Balance Sheet


In this part of the exercise you create rules to transfer retained profit, dividends received,
and dividends paid from the income statement to the balance sheet.

m y
d e
c a
e A
c l
r a
The Custom 1 dimension of the Apex application contains hierarchies for balance sheet
movement. Transfers from the income statement are stored in the P_L member of

O ly
Custom 1, which is set to SwitchSignForFlow to accommodate periodic values. You

& On
need to create the following calculations:

l
a e
• Transfer the total from the RetainedProfit account to the RetainedIncome account.

n
t e r U s
• Transfer the total from the DivisRecd_PL account to the DivisRecd_BS account.
• Transfer the total from the DivisPaid_PL account to the DivisPaid_BS account.

I n
These rules should be executed for all scenarios.

c l e
r a
O
Hyperion Financial Management 9.3.1: Create Rules 7
Lesson 3 Controlling the Scope of Rules
Exercises

Before you create the rules, review the custom dimensions settings for the following
accounts:
• RetainedProfit
• RetainedIncome
• DivisRecd_PL
• DivisRecd_BS
• DivisPaid_PL
• DivisPaid_BS
To test the rules, open the P&L Transfer data grid. Verify that Custom1 is set to P_L in
the point of view. Use Force Calculate to calculate the grid. Note the balance sheet
account numbers for February. Change the view for Custom1 to the top member and
verify that the income statement balances match the balances transferred to the balance
sheet accounts.

m y
d e
c a
e A
c l
r a
O ly
l & On
n a e
t e r U s
I n
c l e
r a
O
8 Hyperion Financial Management 9.3.1: Create Rules
Lesson 4 Creating Dynamic Rules
Exercises

Lesson 4 Creating Dynamic Rules

Exercise 4.1 Creating a Percent of Sales Calculation for the


Periodic View
In this exercise you create a rule to calculate the current period sales as a percentage of
annual sales.
Open the Apex3.rle file and save the file as Apex4.rle
Create a rule for the PctAnnualSales account that divides the NetSales account for the
current period by the total sales for the year.
Be sure to multiple the product by 100 so that the result is expressed as a percentage.
This rule is valid only for the Periodic view.
To test your rule, use the Analysis data grid. Verify that the rule is executed only for the
Periodic data view.

Exercise 4.2 Creating a Gross Margin Calculation


m y
d e
In this exercise you create a rule to calculate gross margin percentage by product.

c a
Create a rule for the GMPercent account that divides the GrossMargin account by the

e
as a percentage. This rule should be executed for all views. A
NetSales account. Be sure to multiple the product by 100 so that the result is expressed

c l
To test your rule, use the Analysis data grid with the point of view set to West Sales,
February.
r a
O ly
l & On
n a e
t e r U s
I n
c l e
r a
O
Hyperion Financial Management 9.3.1: Create Rules 9
Lesson 5 Creating Custom Procedures
Exercises

Lesson 5 Creating Custom Procedures

Exercise 5.1 Creating a Custom Sub Procedure


In this exercise you move the rules for the Discounts account calculation from the Sub
Calculate procedure to a custom Sub procedure.
Open the Apex4.rle file and save the file as Apex5.rle
Create a new Sub procedure named DiscountsCalc. Include variables to receive the
following information from the calling procedure:
• The rates for each customer type
• The total member for the Value dimension
Move the rules for calculating the Discounts account from the Sub Calculate procedure
to the Sub DiscountsCalc procedure.
In the Sub Calculate procedure, add a call to the Sub DiscountsCalc procedure, passing
the rates for each customer type and the total member for the Value dimension.
Use the NetSales data grid to test the procedure.
m y
d e
Exercise 5.2 Creating a Custom Function
c a
A
Apex uses annualized values for certain accounts in its financial reports. In this exercise

e
to it as a parameter.
c l
you create a custom function that returns an annualized balance for any account passed

r a
Create a new function named Annualize with variables to receive an account name and

O ly
the current period from the calling procedure.

l & On
The Annualize function should perform the following calculation for the account passed
to it from the calling procedure:

n a e
(Year-to-data balance / Current period number) * 12

t e r U s
In the Sub Calculate procedure, use the Annualize function to calculate annualized

I n
values for the NetSales account and the COS accounts, storing the annualized balances
for NetSales in the NetSales_A account and for COS in the COS_A account.

c l e
Use the Annualize data grid for WestSales, Budget, 2006 to test the function.

r a
O
10 Hyperion Financial Management 9.3.1: Create Rules
Lesson 5 Creating Custom Procedures
Exercises

Exercise 5.3 Creating a Custom Logging Procedure


In this exercise you create a custom logging procedure.
Create a custom procedure named WriteToFile that writes text passed from the calling
procedure to a log file. A date and time stamp should be added to the text string passed
from the calling procedure. Use any path and file name that you like for the log file.
To test the WriteToFile procedure, add two calls to the WriteToFile procedure from the
Sub Calculate procedure. Place the first call before the first rule in Sub Calculate. It
should include the text “Sub Calculate procedure started for,” concatenated with the
current entity and scenario. Place the second call after the last rule in the Sub Calculate
procedure. It should include the text “Sub Calculate procedure ended.”
Run the Sub Calculate procedure from any data grid and view the log file.

m y
d e
c a
e A
c l
r a
O ly
l & On
n a e
t e r U s
I n
c l e
r a
O
Hyperion Financial Management 9.3.1: Create Rules 11
Lesson 6 Creating Arrays and Loops
Exercises

Lesson 6 Creating Arrays and Loops

Exercise 6.1 Creating Loops with Member Lists


To encourage conservation, some states provide a tax credit for products that are
manufactured from recycled products. In the Apex application, products that are eligible
for the tax credit have the code “recyc” entered for the UD1 attribute. In this exercise you
calculate the tax credit for these products.
Open the Apex5.rle file and save the file as Apex6.rle
• Create a Sub procedure named TaxCredit with a variable to receive the rate from the
calling procedure.
• Use a system-defined member list to store all base members for the Custom2 parent
member Products in an array variable.
• Use a For...Next loop to test each product in the member list for the “recyc” attribute
in UD1. For products that have the attribute, calculate the tax credit and store it in the
EnvCredit account.
TIP
m y
You can use the UD1, UD2, and UD3 functions to retrieve user-defined
d e
attributes of member. For example, HS.Custom2.UD2(“Concrete”) retrieves

c
variable in place of literal text to specify the member name.
a
the UD2 property for the Concrete member of custom2. You can use a

e A
c l
• Use calls to the WriteToFile procedure to 1) log each product processed in the

r a
For...Next loop and 2) log each product for which the tax credit was calculated.

O ly
• In the Sub Calculate procedure, add calls to the TaxRate procedure.

Massachusetts.
l & On
- You should call the procedure only for entities that are descendants of California or

n a e
t e r
- The tax rate for the state should be passed as a parameter. The tax credit is 1
s
percent of gross sales for California and .8 percent for Massachusetts.
U
TIP
I n
You can use the IsDescendant function to test whether a member is a

c l e
descendant of a parent. For example, HS.Entity.IsDescendant(“France“, “”)

r a tests whether the current entity is a descendant of the member France.

O
12 Hyperion Financial Management 9.3.1: Create Rules
Lesson 6 Creating Arrays and Loops
Exercises

Include a call to the WriteToFile procedure to log the name of the entity for which the
TaxRate procedure is run.
Use the TaxCredit data grid to test the rule. Run the rule for the WestSales entity and the
1200 entity for January, Budget, 2006. The products with the “recyc” attribute are Steel,
Plasterboard, and Plastic. Review the log file.

Exercise 6.2 Working with Data Units


In this exercise you modify the Sub TaxCredit procedure to use a data unit instead of a
member list.
Copy the Sub TaxCredit procedure to a new procedure named Sub TaxCreditData. Make
the following changes to the TaxCreditData procedure:
• Replace the HS.List function with the OpenDataUnit function. Use the OpenDataUnit
function to create a data unit for the GrossSales account. Determine the correct
custom dimension settings.
• Use the GetNumItems function to verify that there are data units before you continue
processing.
• Modify the For...Next statement to loop through the data unit using the GetItem
m y
function.
d e
of the array variable.
c a
• Use the variable for the Custom2 dimension defined in the GetItem function in place

A
• To calculate the tax credit, multiply the data variable defined in the GetItem function
e
by the Rate.
c l
r a
• Modify the Sub Calculate procedure to call TaxCreditData instead of TaxCredit.

O ly
Use the TaxCredit data grid to test the rule. Run the rule for the WestSales entity and the
1200 entity for January, Budget, 2006. Compare the log for the TaxCreditData procedure

l & On
to the log for the TaxCredit procedure. The TaxCreditData procedure should have

a e
processed less items than the TaxCredit procedure.

n
t e r U s
I n
c l e
r a
O
Hyperion Financial Management 9.3.1: Create Rules 13
Lesson 7 Working with Financial Management Data
Exercises

Lesson 7 Working with Financial Management


Data

Exercise 7.1 Retrieving Data With the GetCell Function


Apex manually inputs data for most overhead expenses. Exceptions are Travel, Phone,
and Stationery, which are calculated at fixed rates according to the head count for each
entity. Headcount is entered in the Employee account. The Employee account is a
balance recurring account, so data entered in the current month automatically carries
forward as derived data to future months.
In this exercise you create rules to calculate overhead based on head count for Travel,
Phone, and Stationery.
Open the Apex6.rle file and save the file as Apex7.rle
Use the GetCellNoData function to retrieve the number of employees for the current
entity and store it in a variable named vHC. You use GetCellNoData because you want
the rules to execute if there is either real or derived data.
Create an If..Then statement to verify that there is either real or derived data for the
Employee account.
m y
d e
Within the If...Then statement, create rules to calculate Travel, Phone, and Stationery
based on the head count variable and these rates:
c a
• Travel: 100
• Phone: 50
e A
• Stationery: 25
c l
r a
To test the rules, open the Headcount grid for Budget, 2006. Enter 50 for January,
WestSales. Submit the data:
O ly
Budget, 2006.
l & On
Open the Input Overhead grid. Verify that the point of view is WestSales, January,

n a e
Calculate January. The results should match the following:
• Travel: 5000
t e r U s
• Phone: 2500
I
• Stationery: 1250 n
c l e
Change the entity to Plant1 and calculate January. Because there is no real or derived

a
Employee data for Plant1, the rules should not execute and the cells should be blank.
r
O
14 Hyperion Financial Management 9.3.1: Create Rules
Lesson 7 Working with Financial Management Data
Exercises

Exercise 7.2 Applying Rounding to Data


Apex uses a scenario named Rounded for reporting purposes. The Rounded scenario
contains the data from the Actual scenario rounded to thousands.
Create a new Sub procedure named Rounding. Create rules to copy base-level data
from the Actual scenario to the Rounded scenario, rounding the values to thousands.
Follow these guidelines:
• The Sub procedure should be called only if Rounded is the current scenario in the
point of view.
• Use the HS.Rounding function to enable rounding to thousands.
• Use the Base system list with the Account dimension to create an array variable for
all base-level accounts.
• Loop through all of the accounts and use the HS.Exp function to retrieve data from
the Actual scenario for each account.
To test the rule, use the Rounding data grid with the point of view to West Sales, January,
2006, Budget, GrossSales.

m y
Exercise 7.3 Creating a NoInput Procedure
d e
In this exercise you set accounts to no input.

c a
Create a NoInput Sub procedure and write rules to set the following accounts to no input:

e
• The Discounts account in the Budget scenario A
c l
• The Travel, Phone and Stationery members of the Custom2 dimension for the
Overheads account.
r a
O ly
• All accounts in the Rounded scenario

& On
Use the NetSales, Input Overhead, and Rounding data grids to test the rule.
l
n a e
t e r U s
I n
c l e
r a
O
Hyperion Financial Management 9.3.1: Create Rules 15
Lesson 8 Working with Dimension Hierarchies
Exercises

Lesson 8 Working with Dimension Hierarchies

Exercise 8.1 Calculating Closing Balances


Apex tracks balance sheet movement in the Custom1 dimension. In this exercise you
create a rule to calculate the value for the Closing member of the Custom1 dimension
based on the opening balance and the movement members.
Open the Apex7.rle file and save the file as Apex8.rle
In the Sub Calculate procedure, create a rule that performs the following calculation in
the Custom1 dimension:
Closing = Opening + P_L + Cash + Other
You test this rule together with the calculation status rule in the next exercise.

Exercise 8.2 Managing Calculation Status


In this exercise you create a rule to manage calculation status.

m y
d
status of the first period of the following year should be impacted. Create a sube
If it is the last period in the year and the Sub Calculate procedure is run, the calculation

c a
procedure named ImpactOpenings that use the ImpactStatus function to accomplish this.
Remember that if the Next keyword is used to cross to an invalid year an error is
A
returned. You should call the procedure from the Sub Calculate procedure.

e
l
Use the OpeningBalances data grid to test the closing balance and impact status rules:
c
a
• Enter test data in the Opening and Cash members for December 2006 and calculate.
r
O ly
• Verify the Closing Balance calculation.

it was impacted.
l & On
• Change the point of view to January 2007. Check the calculation status to verify that

n a e
• Calculate December of 2014 to verify that the ImpactOpenings procedure does not

e r s
attempt to impact invalid years.
t U
I n
Exercise 8.3

c l e Setting Opening Balances

r a
For balance sheet accounts, Apex takes the closing balance of the prior period as the
opening balance for the current period.

O
16 Hyperion Financial Management 9.3.1: Create Rules
Lesson 8 Working with Dimension Hierarchies
Exercises

In this exercise you create rules to set opening balances for balance sheet accounts.
Create a custom procedure named Opening with the necessary rules. Follow these
guidelines:
• For the Custom1 dimension, use an HS.Exp expression to set the Opening member
of the current period equal to the Closing member of the prior period.
• Because its data is copied from the Actual scenario, the Rounded scenario should be
excluded.
• The rule should not be executed for the first period of the first year.
TIP
Because the Opening and Closing members of the Custom1 dimension are valid
only for balance sheet accounts, you do not need to include the Account
dimension in the HS.Exp expression.

Call the Opening procedure from the Sub Calculate procedure.


Use the OpeningBalances data grid to test the rule:
• Calculate January of 2007 to verify that the closing balance from December 2006 is
retrieved.

m y
from invalid years.
d e
• Calculate January of 2005 to verify that the rule does not attempt to retrieve data

c a
Exercise 8.4 Creating an Allocation (Optional)

e A
c l
Apex has decided to modify its procedure for calculation overhead. Overhead expenses
for all divisions in each state will be input as a lump sum to the administrative entity for

r a
that state. The overhead expenses will then be allocated to the divisions based on head
count. In this exericse you replace the rules for overhead you created previously with an
allocation procedure. O ly
l & On
Apex will use members in the Custom1 dimension to manage the allocation. The

a e
following graphic shows a sample structure:

n
t e r U s
I n
c l e
r a
O
Hyperion Financial Management 9.3.1: Create Rules 17
Lesson 8 Working with Dimension Hierarchies
Exercises

The lump sum is input to the Unallocated member of the administrative entity. The
allocation of this lump sum to each entity is calculated by a rule and stored in the
Allocated member. Aggregation is turned off for the Unallocated member to avoid double
counting into TotalAllocated.
The following attributes are used in the UD2 field to identify which entities to include in
the allocation for each state: “CA_ALLOC” for California entities, “CT_ALLOC” for
Connecticut entities, and “MA_ALLOC” for Massachusetts entities.
Head count for each entity is stored in the Employee account.
In the Sub Calculate procedure, place apostrophes in front of the previous overhead
allocation rules to turn them into comments. Add a comment line stating that the
overhead calculations are being replaced by an allocation procedure.
Create a Sub Allocate procedure to allocate the overhead expenses for entities in the
United States. Follow these guidelines:
• The allocation should be executed for base-level entities in the United States only.
• Use the Base system member list with the Overheads parent in Custom2 to create
an array variable for the overhead members.
• Loop through the overhead members:
m y
d e
- For each entity, determine the allocation percentage by dividing the entity head
count by the head count of its parent. Use the UD2 attribute to determine the
a
parent and use the GetCell function to retrieve the head count for the parent.
c
e A
- Use the allocation percentage to allocate the value in the Unallocated member of
the administrative entity for the state to the Allocated member of the current entity.

c l
• Modify the Sub Input procedure as follows:

r a
- Remove the NoInput statement for Travel, Phone, and Stationery.

O ly
- Add a NoInput statement for the Allocated member of Custom1.

l & On
Use these guidelines to test the rule:

n a e
• Using the Headcount data grid, enter head count data for the children of California for

t e r U s
January, then consolidate California.

I n
• Using the Overhead data grid for January, 2006, Budget, enter test data in the
UnAllocated member of entity 1000 for the Overhead members.

l e
• Submit and calculate the data.
c
r a
• Select 1000, Plant1, and WestSales, then select Actions > Allocate to allocate the
data. Verify the allocation calculation.
O
18 Hyperion Financial Management 9.3.1: Create Rules
Lesson 8 Working with Dimension Hierarchies
Exercises

• Consolidate California. Both the unallocated and allocated amounts are stored in the
Custom members to enable reporting on any difference. But only the Allocated
member is aggregated to the Income statement.

m y
d e
c a
e A
c l
r a
O ly
l & On
n a e
t e r U s
I n
c l e
r a
O
Hyperion Financial Management 9.3.1: Create Rules 19
Lesson 9 Creating Translation Rules
Exercises

Lesson 9 Creating Translation Rules

Exercise 9.1 Creating Translation Rules


In this exercise you create rules to calculate a currency translation adjustment for
differences due to exchange rates.
Open the Apex8.rle file and save the file as Apex9.rle
Apex uses three accounts for exchange rates:
• The EopRate account stores the end rates.
• The OpeRate account stores prior period end rates.
• The AveRate account stores the average rates.
Apex uses members in the Custom1 dimension to store exchange rate differences for
balance sheet accounts.
• The Rate member of Custom1 stores the difference between opening balance
translated at the current period closing rate and at the prior period closing rate.
• The Move member of Custom1 stores the difference between balance sheet
m y
d e
movement translated at the current period closing rate and the current period
average rate.

c a
• The FX member of Custom1 stores the aggregation of the Rate and Move members.

e A
The CTA account in the Shareholders hierarchy stores the total currency translation
adjustment.
c l
Calculating Exchange Differences r a
O ly
Create translation rules using the Trans function for the following calculations:

l & On
• Calculate the Rate member of Custom1 as the difference between the Opening
a e
member translated at the end rate and at the opening rate.
n
e r s
• Calculate the Move member of Custom1 as the difference between the PL member
t U
translated at the end rate and at the average rate.
TIP I n
c l e
You do not need to specify source or destination accounts. As with the
HS.Exp function, if you omit the Account dimension from the Trans or

r a Transperiod function, the scope of the function includes all accounts for which

O the custom members are valid.

20 Hyperion Financial Management 9.3.1: Create Rules


Lesson 9 Creating Translation Rules
Exercises

Follow these guidelines to test your rules:


1. Open the FX Rates data grid. Verify that the Entity is set to None.
2. Enter test rates for translating from GBP to EUR for January, Budget, 2006 for the
three rate accounts. Enter 2 for OpeRate, 3 for AveRate, and 4 for EndRate.
3. Open the Translation data grid and set the Entity to EmeaServices. Emeaservices is
a child of the UK entity.
4. Enter 1000 as the opening balance for January, Budget, 2006.
5. Submit and calculate the data.
6. Translate the data to EUR.
7. Verify the exchange rate difference in the Rate account is 2000 EUR. This is the
difference between the 4000 EUR calculated using EndRate and the 2000 EUR
calculated using OpeRate.
8. Enter 200 in the P_L member.
9. Submit and calculate the data.
10. Translate the data to EUR.

m y
11. Verify the exchange rate difference in the Move account is 200. This is the difference

AveRate.
d e
between the 800 EUR calculated using EopRate and the 600 EUR calculated using

c a
Calculating the Currency Translation Adjustment

e A
The CapitalEmployed and Shareholder accounts are the top-level accounts in the

c l
balance sheet. The FX member of Custom1 aggregates the exchange differences in the

r a
Rate and Move members. Create a rule to calculate the CTA account as the sum of the
exchange differences for the CapitalEmployed and Shareholders accounts.
O ly
• You want the rule to run after data has been translated, so you should place the rule
& On
in the Sub Calculate procedure. The Sub Calculate procedure is executed both
l
a e
before and after translation.

n
t e r s
• Use an If...Then statement to ensure that the rule is executed only for translated
currencies. The rule should not be executed for Entity Currency.
U
I n
• The rule should be executed for all entities, not just base-level entities

l e
Use the CTA data grid to test the rule. Verify that EUR is selected for the Value

c
dimension. Use Force Translate to run the rule for EmeaServices, Budget, 2006. This

r a
runs both the Sub Translate and Sub Calculate procedures. The amount in the Other
member of Custom1 for the CTA account should equal the sum of the Rate and Move
Oaccounts from the Translation grid.

Hyperion Financial Management 9.3.1: Create Rules 21


Lesson 10 Creating Consolidation Rules
Exercises

Lesson 10 Creating Consolidation Rules

Exercise 10.1 Customizing the Default Consolidation


For base-level entities, Apex tracks gross sales of discontinued products at the product
level. Discontinued products have a code of “discon” in the UD2 attribute. At the parent
level, Apex uses a lump sum for gross sales of discontinued products. This lump sum is
stored in the Discontinued member of Custom2. In this exercise you customize the
consolidation procedure so that discontinued products are consolidated to the
Discontinued member of the parent.
Open the Apex9.rel file and save the file as Apex10.rle.
Before creating consolidation rules, you must enable consolidation rules in the
application settings module. In the Metadata Manager of the Windows client, open
c:\cf\Apex\Apex.xml. In the Application Settings module, enable consolidation rules.
Load Apex.xml to the Apex application.
The c:\cf\Apex\DefaultConsol.rle file contains rules to perform a default
consolidation. Copy the procedures from DefaultConsol.rle to Apex10.rle. Modify
the default consolidation as follows:
m y
• Test the UD2 attribute of the Custom2 member for the text “discon”.
d e
the Custom2 dimension.
c a
• If the UD2 attribute is “discon”, consolidate the data to the Discontinued member of

e A
• If the UD2 attribute is not “discon”, use the default consolidation.

c l
To test the rule, use the CustomConsol data grid. Consolidated the

r a
UnitedStates.California entity for January, Budget, 2006. The Concrete and Plasterboard
products have the “discon” attribute, so data for these products should be consolidated
O ly
from Plant1 and WestSales to the Discontinued member of California. The Concrete and

& On
Plasterboard members for California should have no data.
l
n a e
t e r U s
I n
c l e
r a
O
22 Hyperion Financial Management 9.3.1: Create Rules
Exercise Solutions

Overview
This section contains step-by-step solutions to successfully complete all
exercises. Solutions are grouped by lesson.

m y
d e
c a
e A
c l
r a
O ly
l & On
n a e
t e r U s
I n
c l e
r a
O
Lesson 1 Reviewing Rules Syntax
Solutions

Lesson 1 Reviewing Rules Syntax

Solution 1.1 Find the Errors


These are the syntax mistakes in the first If..Then statement
• The first IF..Then statement is missing the “Then”.
• The first IF..Then statement is closed with “EndIf” instead of “End IF”.
• In the first HS.Exp expression, the hash sign ( # ) before UnitsSold is missing.
• In the second HS.Exp expression, the closing quotation mark is missing.
These are the syntax mistakes in the second If..Then statement
• The angle brackets ( <> )are missing around Entity Currency.
• The dot is missing in front of the C1 dimension.
• The ampersand ( & ) is missing from the line continuation.

m y
d e
c a
e A
c l
r a
O ly
l & On
n a e
t e r U s
I n
c l e
r a
O
24 Hyperion Financial Management 9.3.1: Create Rules
2 Creating Variables
Solutions

Lesson 2 Creating Variables

Solution 2.1 Creating Constants for the Custom and ICP


Dimensions

' ********************************************************************
' This section establishes constants for [None] and top-level
' dimension members. C4 is not used in this application so it is
omitted.
' *********************************************************************
const ALL_NONE = ".I#[ICP None].C1#[None].C2#[None].C3#[None]"
const ALL_TOPS = ".I#[ICP Top].C1#TopC1.C2#TopC2.C3#TopC3"
const NONES_NOC1 = ".I#[ICP None].C2#[None].C3#[None]"
const NONES_NOC3 = ".I#[ICP None].C1#[None].C2#[None]"
const TOPS_NOC1 = ".I#[ICP Top].C2#TopC2.C3#TopC3"
const TOPS_NOC2 = ".I#[ICP Top].C1#TopC1.C3#TopC3"
const TOPS_NOC3 = ".I#[ICP Top].C1#TopC1.C2#TopC2"

m y
Solution 2.2 Creating Header Variables for Sub Calculate
d e
c a
' *********************************************************************
A
' The following subroutine runs when you calculate or consolidate

e
l
' *********************************************************************

c
Sub Calculate()
r a
pov_entity = HS.Entity.Member
O ly
pov_scenario = HS.Scenario.Member
pov_value = HS.Value.Member
l & On
pov_year = HS.Year.Member

n a e
pov_period = HS.Period.Number 'This is the number not the name

t e r
vIsTrans = HS.Value.IsTransCur

U s
vIsBase = HS.Entity.IsBase("","")
'This yields a True or False
'This yields a True or False

End Sub
I n
c l e
r a
O
Hyperion Financial Management 9.3.1: Create Rules 25
Lesson 3 Controlling the Scope of Rules
Solutions

Lesson 3 Controlling the Scope of Rules

Solution 3.1 Creating Variables for the Total Members


' *********************************************************************
' These statements help to determine the right side
' of the equation for the Value dimension when you need to
' retrieve data from one of the Total members.
' *********************************************************************
If pov_value = "<Entity Currency>" Then
vRight_value = ".V#<Entity Curr Total>"
ElseIf vIsTrans = True Then
vRight_value = ".V#" &HS.Value.Currency& " Total”
ElseIf pov_value = "[Proportion]" Then
vRight_value = ".V#[Contribution Total]"
End If

Solution 3.2
'
Setting the Scope of the Rule
********************************************************************'
m y
' The following section is for Entity Currency of base-level
d e
'
'
members only:

c a
*********************************************************************
If pov_value = "<Entity Currency>" Then
If vIsBase Then
e A
'Rules for base entities go here
End If
c l
End If
r a
O ly
Solution 3.3
& On
Working with Custom Dimensions in Rules
l
a e
'***********************************************************************
n
t e r s
'The following section is for Entity Currency of Base Level members only:
'***********************************************************************
U
'
I n
These rules calculate discounts for each type of customer as a
'
'
c l e
pre-defined percentage of Gross Sales
Because the C2 dimension is not valid for Discounts we retrieve
'

r a the value from the top member.


If pov_value = "<Entity Currency>" Then

O If vIsBase Then

26 Hyperion Financial Management 9.3.1: Create Rules


3 Controlling the Scope of Rules
Solutions

If pov_scenario <> "Actual" Then


HS.Exp "A#Discounts.C3#C_Trade ="& _
"A#GrossSales.C2#TopC2"&vRight_value &" * 0.05"
HS.Exp "A#Discounts.C3#C_Wholesale ="& _
"A#GrossSales.C2#TopC2"&vRight_value&" * 0.15"
HS.Exp "A#Discounts.C3#C_Retail ="& _
"A#GrossSales.C2#TopC2"&vRight_value&" * 0.06"
HS.Exp "A#Discounts.C3#C_Other ="& _
"A#GrossSales.C2#TopC2"&vRight_value&" * 0.05"
End If

' Transfer balances from the Income Statement to the Balance Sheet.
' The P_L member in Custom1 stores transfers from the Income Statement
HS.Exp "A#RetainedIncome.C1#P_L" &NONES_NOC1& _
"= A#RetainedProfit" &ALL_TOPS
HS.Exp "A#DivisRecd_BS.C1#P_L"&NONES_NOC1& _
"=A#DivisRecd_PL" &ALL_TOPS
HS.Exp "A#DivisPaid_BS.C1#P_L"&NONES_NOC1& _
"=A#DivisPaid_PL" &ALL_TOPS
End If
End If
End Sub

m y
d e
c a
e A
c l
r a
O ly
l & On
n a e
t e r U s
I n
c l e
r a
O
Hyperion Financial Management 9.3.1: Create Rules 27
Lesson 4 Creating Dynamic Rules
Solutions

Lesson 4 Creating Dynamic Rules

Solution 4.1 Creating a Percent of Sales Calculation for the


Periodic View
' ********************************************************************'
' The following sub routine contains rules for dynamic accounts
' *********************************************************************
Sub Dynamic()
' Calculates current period sales as percent of annual sales.
' This calculation is for periodic view only. Custom1 is not valid
' for NetSales so it is set to None.
HS.Dynamic "A#PctAnnualSales.W#Periodic=A#NetSales.C1#[None]”& _
“.C4#[None] /A#NetSales.C1#[None].C4#[None].P#[Year]*100"

End Sub

Solution 4.2 Creating a Gross Margin Calculation

m y
' The following sub routine contains rules for dynamic accounts
d e
' ********************************************************************'

Sub Dynamic()
c a
' *********************************************************************

A
' Calculates gross margin percentage by product (products are in
e
c l
' Custom2)Gross Margin is tracked by Product so Custom 2 is ommitted.
' Other customs are invalid for Gross Margin so are set to None.

r a
HS.Dynamic "A#GMPercent=A#GrossMargin" &TOPS_NOC2& _

O ly
"/ A#NetSales" &TOPS_NOC2&" * 100"

End Sub
l & On
n a e
t e r U s
I n
c l e
r a
O
28 Hyperion Financial Management 9.3.1: Create Rules
5 Creating Custom Procedures
Solutions

Lesson 5 Creating Custom Procedures

Solution 5.1 Creating a Custom Sub Procedure


Sub Calculate
If pov_scenario <> "Actual" Then
call DiscountsCalc(.05,.15,.06,.05,vRight_value)
End If
End Sub

Sub DiscountsCalc(vTrade,vWSale,vRetail,vOther,vRight_value)
HS.Exp "A#Discounts.C3#C_Trade = A#GrossSales.C2#TopC2"& _
vRight_value& "*" &vTrade
HS.Exp "A#Discounts.C3#C_Wholesale = A#GrossSales.C2#TopC2"& _
vRight_value& "*" &vWSale
HS.Exp "A#Discounts.C3#C_Retail = A#GrossSales.C2#TopC2"& _
vRight_value& "*" &vRetail
HS.Exp "A#Discounts.C3#C_Other = A#GrossSales.C2#TopC2"& _
vRight_value& "*" &vOther
End Sub

m y
d e
Solution 5.2 Creating a Custom Function
c a
Sub Calculate
'Use the Annualize function for NetSales and COS
e A
c l
HS.EXP "A#NetSales_A = " &Annualize("NetSales",pov_period)
HS.EXP "A#COS_A = " &Annualize("COS",pov_period)
End Sub
r a
O ly
Function Annualize(vAcct,vCurrentPeriod)

l & On
' This function takes the YTD value for an account and
' divides it by the current period number to get an average,

a e
' and then multiplies by 12 to get the annualized amount.

n
End Function
t e r
Annualize="A#" &vAcct& ALL_TOPS &".W#YTD /" &vCurrentPeriod& " * 12"

U s
I n
c l e
r a
O
Hyperion Financial Management 9.3.1: Create Rules 29
Lesson 5 Creating Custom Procedures
Solutions

Solution 5.3 Creating a Custom Logging Procedure


Sub WriteToFile(txtStringToWrite)

'If there is an error exit the procedure and


'resume execution of the calling procedure
On Error Resume Next
' Create constants for the update mode and the file name
const READ = 1, WRITE = 2, APPEND = 8
const FILE_NAME = “c:\ruleslog.txt”
'Create variables for the file system and file objects
Dim fso, f
'Create a file system object and open the file
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.OpenTextFile(FILE_NAME, APPEND, True)
'Write a line of text, add date/time stamp, and then close the file
f.WriteLine txtStringToWrite & " " & Now()
f.Close

End Sub

Sub Calculate

m y
'Make sure to place this call after the POV variables section

d e
Call WritetoFile("Calculate sub procedure started for " &pov_entity& _

...
" " &pov_scenario)
c a
...

e A
...

c l
Call WritetoFile("Calculate sub procedure ended for " &pov_entity& _
" " &pov_scenario)
r a
O ly
l & On
n a e
t e r U s
I n
c l e
r a
O
30 Hyperion Financial Management 9.3.1: Create Rules
6 Creating Arrays and Loops
Solutions

Lesson 6 Creating Arrays and Loops

Solution 6.1 Creating Loops with Member Lists


Sub TaxCredit(vRate)
'Store the list of products in an array
aPList=HS.Custom2.List("Products","[Base]")
'Loop through the array of products
For i = Lbound(aPList) to Ubound(aPList)
'Write the product being processed to the log file
call WritetoFile("Processing " &aPList(i))
'Find products with UD1=recyc
IF HS.Custom2.UD1(aPList(i))="recyc" Then
'Calculate tax credit. C2 is only custom valid for EnvCredit
HS.Exp "A#EnvCredit.C2#" &(aPList(i))& "=A#GrossSales.C1#[None]”& _
".C2#" &(aPList(i))& ".C3#TopC3.I#[ICP Top] *" &vRate
'Write the item processed to the log file
Call WritetoFile("Tax credit calculated for: " &aPList(i))
End If
Next
Call WritetoFile("TaxCredit sub procedure ended")
m y
End Sub
d e
Sub Calculate
c
' Call the TaxCredit sub procedure for descendants of Caliornia
a
' and Massachusetts, passing the rate.

e A
c l
If HS.Entity.IsDescendant("California",pov_entity) Then

call TaxCredit(.01)
r a
call WritetoFile("Calculating tax credit for " &pov_entity)

O ly
ElseIf HS.Entity.IsDescendant("Massachusetts",pov_entity) Then

call TaxCredit(.008)
l & On
call WritetoFile("Calculating tax credit for " &pov_entity)

End IF

n a e
t e r U s
I n
c l e
r a
O
Hyperion Financial Management 9.3.1: Create Rules 31
Lesson 6 Creating Arrays and Loops
Solutions

Solution 6.2 Working with Data Units


Sub TaxCreditData(vRate)
'Open a data unit for GrossSales for all products with data
Set DataUnit=HS.OpenDataUnit ("A#GrossSales.C1#[None].C3#TopC3” &_
".C4#[None]")
NumItems=DataUnit.GetNumItems
If NumItems > 0 then
For i=0 to NumItems-1
call
DataUnit.GetItem(i,Account,ICP,Custom1,Custom2,Custom3,Custom4,Data)
call WritetoFile("Processing" & Custom2)
IF HS.Custom2.UD1(Custom2)="recyc" Then
HS.Exp "A#EnvCredit.C2#" &Custom2& "=" &Data& "*" &vRate
call WritetoFile("Tax credit calculated for: " & Custom2)
End If
Next
End If
Call WritetoFile("TaxCreditData sub procedure ended")
End Sub

m y
d e
c a
e A
c l
r a
O ly
l & On
n a e
t e r U s
I n
c l e
r a
O
32 Hyperion Financial Management 9.3.1: Create Rules
7 Managing Financial Management Data
Solutions

Lesson 7 Managing Financial Management Data

Solution 7.1 Retrieving Data With the GetCell Function


'Calculate overhead based on headcount and rate
vHC=HS.GetCellNoData("A#Employee.I#[ICP
None].C1#[None].C2#[None].C3#[None].C4#[None]",NoData )
If Not NoData Then
HS.Exp "A#Overheads.I#[ICP
None].C1#UnAlloc.C2#Travel.C3#[None].C4#[None] ="&vHC&" *100"
HS.Exp "A#Overheads.I#[ICP
None].C1#UnAlloc.C2#Phone.C3#[None].C4#[None] ="&vHC&"*50"
HS.Exp "A#Overheads.I#[ICP
None].C1#UnAlloc.C2#Stationery.C3#[None].C4#[None] ="&vHC&"*25"
End If

Solution 7.2 Appying Rounding to Data


Sub Rounding()
Dim Round_List
m y
'Enable rounding to thousands
d e
HS.Round(1000)
'Create an array of all base-level accounts
c a
Round_List = HS.Account.List("", "[Base]")
'Loop through the accounts and copy the values
e A
'from the actual scenario

c l
For i = LBound(Round_List) To UBound(Round_List)

r a
HS.Exp "A#" &Round_List(i)& " = A#" &Round_List(i)& ".S#Actual"
Next
'Disable rounding
O ly
HS.NoRound
End Sub
l & On
n a e
Sub Calculate

e r s
'Place this at the end of Sub calculate because you want
t U
'other rules to be run before the values are copied.

I n
If pov_scenario = "Rounded" Then
call Rounding()
End If
c l e
r a
End Sub

O
Hyperion Financial Management 9.3.1: Create Rules 33
Lesson 7 Managing Financial Management Data
Solutions

Solution 7.3 Creating a NoInput Procedure


Sub NoInput
HS.NoInput "S#Rounded"
HS.NoInput "A#Discounts.S#Budget"
HS.NoInput "A#Overheads.C2#Travel"
HS.NoInput "A#Overheads.C2#Phone"
HS.NoInput "A#Overheads.C2#Stationery"
End Sub

m y
d e
c a
e A
c l
r a
O ly
l & On
n a e
t e r U s
I n
c l e
r a
O
34 Hyperion Financial Management 9.3.1: Create Rules
8 Working with Dimension Hierarchies
Solutions

Lesson 8 Working with Dimension Hierarchies

Solution 8.1 Calculating Closing Balances


'Calculate closing balances
HS.Exp "C1#Closing = C1#Opening + C1#P_L + C1#Cash + C1#Other"

Solution 8.2 Managing Calculation Status


Sub ImpactOpenings()
'If it is December, impact January of the next year.
If HS.Period.IsLast Then
'Verify that the next year is a valid year
If Not HS.Year.IsLast Then
HS.ImpactStatus "Y#NEXT.P#FIRST"
End If
End If
End Sub

m y
Solution 8.3 Setting Opening Balances d e
Sub Calculate c a
'Call the Opening procedure to set opening balances

e A
End Sub
c l
call Opening("C1#Opening", "C1#Closing", pov_scenario)

r a
Sub Opening(sPOVDest, sPOVSource, vScenario)
O ly
If Not ( HS.Year.IsFirst And HS.Period.IsFirst) Then

l & On
If vScenario <> "Rounded" Then
HS.Exp sPOVDest &" = "& sPOVSource & ".P#Prior"
End If
n a e
End If
End Sub
t e r U s
I n
c l e
r a
O
Hyperion Financial Management 9.3.1: Create Rules 35
Lesson 8 Working with Dimension Hierarchies
Solutions
Solution 8.4 Creating an Allocation (Optional)
Sub Allocate
pov_entity=HS.Entity.Member
vIsBase=HS.Entity.IsBase("","")
vAlloc=HS.Entity.UD2(pov_entity)
Call WritetoFile("Allocation sub procedure stated for " &pov_entity)
If vISBase Then
'Store the list of overhead members in an array
aOvers=HS.Custom2.List("Overheads","[Base]")
'Loop through the array of products
For Each Item In aOvers
'Write the product being processed to the log file
Call WritetoFile("Processing " &Item)
'Determine the parent
Select Case vAlloc
Case "CA_ALLOC"
'Divide parent headcount by child headcount
'to get the allocation percentage
vPct=HS.GetCell("A#Employee"
&ALL_NONES)/HS.GetCell("E#California.A#Employee" &ALL_NONES)
'Multiply the unallocated amount by the allocation percentage
HS.Exp "A#Overheads.C1#Allocated.C2#" &Item& _
"=E#1000.A#Overheads.C1#UnAlloc *" &vPct
m y
call WritetoFile("Allocated "&vPct& "for: " &Item)
Case "CT_ALLOC"
d e
vPct=HS.GetCell("A#Employee"
&ALL_NONES)/HS.GetCell("E#Connecticut.A#Employee" &ALL_NONES)c a
HS.Exp "A#Overheads.C1#Allocated.C2#" &Item& _

e A
c l
"=E#1100.A#Overheads.C1#UnAlloc *" &vPct
call WritetoFile("Allocated "&vPct& "for: " &Item)
Case "MA_ALLOC"
r a
vPct=HS.GetCell("A#Employee"

O ly
&ALL_NONES)/HS.GetCell("E#Massachusetts.A#Employee" &ALL_NONES)

l & On
HS.Exp "A#Overheads.C1#Allocated.C2#" &Item& _
"=E#1200.A#Overheads.C1#UnAlloc *" &vPct

End Select
n a e
call WritetoFile("Allocated "&vPct& "for: " &Item)

Next
End If
t e r U s
I n
Call WritetoFile("Allocation sub procedure ended for " &pov_entity)
End Sub

c l e
Sub NoInput

r a
HS.NoInput "S#Rounded"
HS.NoInput "A#Discounts.S#Budget"
OHS.NoInput "A#Overheads.C1#Allocated”
End Sub

36 Hyperion Financial Management 9.3.1: Create Rules


9 Creating Translation Rules
Solutions

Lesson 9 Creating Translation Rules

Solution 9.1 Creating Translation Rules


Sub Translate
'Calculate change due to exchange rates
HS.Trans "C1#Rate","C1#Opening","A#EopRate","A#OpeRate"
HS.Trans "C1#Move","C1#P_L","A#EopRate","A#AveRate"
End Sub

Sub Calculate
' ********* Currency translation adjustment
'If the current member is a translated currency,
'then update the CTA account with the currency adjustment total
If vIsTrans Then
HS.Exp "A#CTA.C1#Other=A#CapitalEmployed.C1#FX +” & _
“A#Shareholders.C1#FX"
End IF

m y
d e
c a
e A
c l
r a
O ly
l & On
n a e
t e r U s
I n
c l e
r a
O
Hyperion Financial Management 9.3.1: Create Rules 37
Lesson 10 Creating Consolidation Rules
Solutions

Lesson 10 Creating Consolidation Rules

Solution 10.1 Customizing the Default Consolidation


Sub Consolidate()
dim vPcon, vParent, vPlug
vPcon=HS.Node.PCon("")
vParent=HS.Parent.Member
'Open a data unit to retrieve data for the current point of view
Set ConsUnit = HS.OpenDataUnit("")
'Create a loop to process each item in the data unit
NumItems = ConsUnit.GetNumItems
For i = 0 to NumItems -1
'Retrieve an item from the data unit
call ConsUnit.GetItem(i, vAcc, vICP, vC1, vC2, vC3, vC4, vData)
'Verify that this item needs consolidation
If HS.Account.IsConsolidated(vAcc) And vData <> 0 Then
'If it is a discountinued item, move its data
'to the Discontinued member
If HS.Custom2.UD2(vC2)="discon" Then
HS.Con "C2#Discontinued", vPcon, ""
m y
Else
'If it is not discontinued, use the default consolidation
d e
HS.Con "", vPcon, ""
End IF c a
'Retrieve the plug account

e A
vPlug = HS.Account.PlugAcct(vAcc)

c l
'Call the elimination test function

r a
If CanEliminate(vPlug,vParent,vICP) Then
'Reverse the sign and write data to the Elimination member

O ly
HS.Con "V#[Elimination]", -vPcon, ""

l & On
'Write the data to the plug account
HS.Con "A#" &vPlug& ".V#[Elimination]", vPcon, ""
End If
End If
n a e
Next
End Sub
t e r U s
I n
c l e
r a
O
38 Hyperion Financial Management 9.3.1: Create Rules

Das könnte Ihnen auch gefallen