Professional Documents
Culture Documents
Hyperion 11.1.1.3 Rules Student Guide
Hyperion 11.1.1.3 Rules Student Guide
com
Hyperion Rules Student Guide || BISP || Amit Sharma || Created by : Rupam Majumdar Page 1
http://learnhyperion.wordpress.com
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
You can then use the variable in a series of calculations in your procedure,
instead of retrieving the value from the application each time.
Hyperion Rules Student Guide || BISP || Amit Sharma || Created by : Rupam Majumdar Page 2
http://learnhyperion.wordpress.com
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 VariableName
For example,
Dim vAcc1
You can create multiple variables with a single Dim statement by separating
the variable names with commas.
Hyperion Rules Student Guide || BISP || Amit Sharma || Created by : Rupam Majumdar Page 3
http://learnhyperion.wordpress.com
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.
Hyperion Rules Student Guide || BISP || Amit Sharma || Created by : Rupam Majumdar Page 4
http://learnhyperion.wordpress.com
You can use conversion functions to explicitly set the data type:
This example converts the result of the calculation to an integer and stores it
in the variable vGM_Pct
Hyperion Rules Student Guide || BISP || Amit Sharma || Created by : Rupam Majumdar Page 5
http://learnhyperion.wordpress.com
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.
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:
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.
Hyperion Rules Student Guide || BISP || Amit Sharma || Created by : Rupam Majumdar Page 6
http://learnhyperion.wordpress.com
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
Hyperion Rules Student Guide || BISP || Amit Sharma || Created by : Rupam Majumdar Page 7
http://learnhyperion.wordpress.com
Hyperion Rules Student Guide || BISP || Amit Sharma || Created by : Rupam Majumdar Page 8
http://learnhyperion.wordpress.com
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.
Example
Hyperion Rules Student Guide || BISP || Amit Sharma || Created by : Rupam Majumdar Page 9
http://learnhyperion.wordpress.com
To simplify your code, you can store the text string for custom and ICP
members in a variable or constant, as in this example
You can then use the constant or variable in the account expression in place of
the string:
Because the custom and top member names do not change when the Point of
View changes, you can use constants instead of 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:
Because the global member names do not change when the Point of View
changes, you can use constants instead of variables.
Hyperion Rules Student Guide || BISP || Amit Sharma || Created by : Rupam Majumdar Page 10
http://learnhyperion.wordpress.com
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.
You can use the Not keyword to test for a false condition. This statement
executes only if the entity is not a base member:
For clarity in your code, you can specify True or False as the condition:
Hyperion Rules Student Guide || BISP || Amit Sharma || Created by : Rupam Majumdar Page 11
http://learnhyperion.wordpress.com
Because the results returned by these functions can change based on the Point
of View, you must use variables rather than constants.
Hyperion Rules Student Guide || BISP || Amit Sharma || Created by : Rupam Majumdar Page 12
http://learnhyperion.wordpress.com
ISConsolidated
EnableCustom1...4Aggr
ISCalculated
UsesLineItems
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.
Hyperion Rules Student Guide || BISP || Amit Sharma || Created by : Rupam Majumdar Page 13
http://learnhyperion.wordpress.com
Syntax
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:
Hyperion Rules Student Guide || BISP || Amit Sharma || Created by : Rupam Majumdar Page 14
http://learnhyperion.wordpress.com
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.
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.
• 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.
• 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.
Hyperion Rules Student Guide || BISP || Amit Sharma || Created by : Rupam Majumdar Page 15
http://learnhyperion.wordpress.com
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 year’s 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.
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.
Hyperion Rules Student Guide || BISP || Amit Sharma || Created by : Rupam Majumdar Page 16
http://learnhyperion.wordpress.com
Syntax
Sub ProcedureName (Var1,Var2,Var3,...)
...
...
End Sub
Hyperion Rules Student Guide || BISP || Amit Sharma || Created by : Rupam Majumdar Page 17
http://learnhyperion.wordpress.com
Arguments
ProcedureName The name of the procedure
(Var1,Var2, Var3,...) :A list of variable names to receive values passed from
the calling procedure.
Hyperion Rules Student Guide || BISP || Amit Sharma || Created by : Rupam Majumdar Page 18
http://learnhyperion.wordpress.com
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.)
Hyperion Rules Student Guide || BISP || Amit Sharma || Created by : Rupam Majumdar Page 19