hyperion 11rule2bisp

Upload: sreevenurain

Post on 03-Apr-2018

224 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/28/2019 Hyperion 11Rule2BISP

    1/22

    http://learnhyperion.wordpress.com

    Hyperion 11.1.1.3 Rules

    Student Guide

    Provided By: BISP Created By: Rupam

    Majumdarhttp://bispsolutions.wordpress.com SME - Hyperion

    [email protected] Reviewed By: Amit

    Sharma

    http://learnhyperion.wordpress.com BISP Team

    Hyperion Rules Student Guide || BISP || Amit Sharma || Created by : RupamMajumdar Page 1

    http://bispsolutions.wordpress.com/mailto:[email protected]://learnhyperion.wordpress.com/http://bispsolutions.wordpress.com/mailto:[email protected]://learnhyperion.wordpress.com/
  • 7/28/2019 Hyperion 11Rule2BISP

    2/22

    http://learnhyperion.wordpress.com

    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.

    Variables temporarily store values when your script is

    running.

    Variables simplify rules scripts.

    Variables improve rules performance.

    Hyperion Rules Student Guide || BISP || Amit Sharma || Created by : RupamMajumdar Page 2

  • 7/28/2019 Hyperion 11Rule2BISP

    3/22

    http://learnhyperion.wordpress.com

    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

    For example,

    Dim vAcc1

    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

    Hyperion Rules Student Guide || BISP || Amit Sharma || Created by : RupamMajumdar Page 3

  • 7/28/2019 Hyperion 11Rule2BISP

    4/22

    http://learnhyperion.wordpress.com

    You can create multiple variables with a single Dim statement by

    separating the variable names with commas.

    ExampleDim vAcc1, vAcc2, vAcc3You assign values to variables using an equal sign (=), with thevariable name on the left and the value you want to assign the

    variable on the right. You can assign literal text strings, numericvalues, return values of functions, or return values of expressions.If the variable does not exist, it is created on the fly. To assign aliteral string value, you enclose the string in quotation marks. Youdo not need quotation marks to assign numeric values, functionresults, or expression results.

    Declare variables explicitly using Dim statements

    Create variables on the fly

    Enclose values in quotation marks to enter a literal text

    string

    You can concatenate variables with literal text strings

    Hyperion Rules Student Guide || BISP || Amit Sharma || Created by : RupamMajumdar Page 4

  • 7/28/2019 Hyperion 11Rule2BISP

    5/22

    http://learnhyperion.wordpress.com

    Variables and Data Types

    In VBScript, you cannot specify in advance that a variable holdsonly a particular data type. Instead, you must use a variableknown as a variant to store any data type.When you assign a value to the variable, VBScript automaticallyassigns the data type. Sometimes you may need to override thedefault data type. For example, you may need to store all values

    as integers.

    You can use conversion functions to explicitly set the data type:

    Hyperion Rules Student Guide || BISP || Amit Sharma || Created by : RupamMajumdar Page 5

  • 7/28/2019 Hyperion 11Rule2BISP

    6/22

    http://learnhyperion.wordpress.com

    This example converts the result of the calculation to an integerand stores it in the variable vGM_Pct

    Variables and Constants

    Variables can be used only in the Sub procedure in which they are

    created. Constants are similar to variables, but with thesedifferences: You can use constants in all Sub procedures within the script. After you define a constant (that is, after it has been assigned avalue), you cannot change it. You can declare constants anywherein the script file. If constants are declared at the beginning of the

    Hyperion Rules Student Guide || BISP || Amit Sharma || Created by : RupamMajumdar Page 6

  • 7/28/2019 Hyperion 11Rule2BISP

    7/22

    http://learnhyperion.wordpress.com

    file, outside of any procedure, they are available to all proceduresat all times. If constants are declared within a procedure, they areavailable only for that procedure.

    You can use constants to store application information that youuse frequently but that does not change. For example, you cancreate constants to store member names that are used frequentlywithin account expressions. By using a short constant name inplace of a long string of member names, you reduce the likelihoodof errors. In Financial Management rules, you typically useconstants to store information that does not vary with the Point ofView settings for which the rules are run.

    Unlike variables, you must explicitly declare constants. Theycannot be created on the fly.

    Syntax

    const Name=Value

    where Name is the name of the constant and Value is the value ofthe constant. The rules for naming constants are the same as forvariables. This example creates a constant named AVE andassigns 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 ofactual values, just as you use variables.

    Syntaxconst Name=Valuewhere Name is the name of the constant and Value is the value ofthe constant. The rules for naming constants are the same as for

    Hyperion Rules Student Guide || BISP || Amit Sharma || Created by : RupamMajumdar Page 7

  • 7/28/2019 Hyperion 11Rule2BISP

    8/22

    http://learnhyperion.wordpress.com

    variables. This example creates a constant named AVE andassigns it a string as a value:

    Example

    Creating Header Sections for Variables and Constants

    Hyperion Rules Student Guide || BISP || Amit Sharma || Created by : RupamMajumdar Page 8

  • 7/28/2019 Hyperion 11Rule2BISP

    9/22

    http://learnhyperion.wordpress.com

    It is a useful practice to create a standard header section in yourSub procedures with variables for frequently used information foryour application. For application information

    that does not changed based on the Point of View, you can createa constants header section at the beginning of the rules file.These are some common types of information to include in aheader section: Current Point of View members for page dimensions Top and None members for custom and ICP dimensions Global account members Conditional statement triggers

    These are some typical types of information stored in header

    section variables:

    The current POV members for the POV dimensions

    Top and [None] members for custom and ICP dimensions;global Accounts

    Hyperion Rules Student Guide || BISP || Amit Sharma || Created by : RupamMajumdar Page 9

  • 7/28/2019 Hyperion 11Rule2BISP

    10/22

    http://learnhyperion.wordpress.com

    Triggers for conditional statements

    Point of View VariablesInformation about the current Point of View members for theEntity, Scenario, Year, and Value dimensions is typically usedthroughout a Sub procedure. Instead of repeatedly retrieving thisinformation from the application, you can retrieve it once at the

    beginning of the procedure and store it in a variable. You can thenuse the value stored in the variable when a rule requires Point ofView information.You retrieve the Point of View using the Member function. Forexample,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.

    T I PFor the variable for the current period, you can useHS.Period.Number instead of HS.Period.Member. Because thefiscal year can start on different months indifferent applications, if you use period numbers rather thanmember names, it is easier to reuse your rules in more than oneapplication.

    Top and None Members for Custom and ICP DimensionsCustom and ICP dimensions in account expressions often need tobe set to the top member or the [None] member. This can resultin a long expression that is difficult both to type and to read.

    Example

    Hyperion Rules Student Guide || BISP || Amit Sharma || Created by : RupamMajumdar Page 10

  • 7/28/2019 Hyperion 11Rule2BISP

    11/22

    http://learnhyperion.wordpress.com

    To simplify your code, you can store the text string for customand ICP members in a variable or constant, as in this example

    You can then use the constant or variable in the accountexpression in place of the string:

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

    Global AccountsYou frequently need to refer to global accounts in your rules, suchas the accounts used to store exchange rates or head count. You

    can create variables or constants for these accounts and then usethem throughout your file. For example:

    Hyperion Rules Student Guide || BISP || Amit Sharma || Created by : RupamMajumdar Page 11

  • 7/28/2019 Hyperion 11Rule2BISP

    12/22

    http://learnhyperion.wordpress.com

    Because the global member names do not change when the Pointof View changes, you can use constants instead of variables.

    Conditional Statement TriggersFinancial Management provides a number of functions that returna value of true or false. You can use these functions as tests in

    conditional statements. For example, before executing a rule, youmight test whether it is true or false that the current year is thefirst year in the application or that the current entity is a baseentity.To make your rules file more efficient, you can perform the testonce and store the result in a variable in your header section. Forexample:

    You can then use the variable as needed in conditionalstatements. Because they are Boolean values, a value of True isassumed as the test.

    Hyperion Rules Student Guide || BISP || Amit Sharma || Created by : RupamMajumdar Page 12

  • 7/28/2019 Hyperion 11Rule2BISP

    13/22

  • 7/28/2019 Hyperion 11Rule2BISP

    14/22

    http://learnhyperion.wordpress.com

    Because the results returned by these functions can changebased on the Point of View, you must use variables rather thanconstants.

    Dynamic Account Types

    Dynamic accounts are accounts whose values are dynamicallycalculated when the data is requested. Ratios and percentages

    are the most common type of dynamic calculations. Only baseaccounts can be dynamic.Dynamic accounts ignore the following account attributes:

    ISConsolidated

    EnableCustom1...4Aggr

    ISCalculated

    UsesLineItems

    The IsConsolidated and EnableEnableCustom1...4Aggr attributesdo not apply to dynamic accounts because dynamic accounts arerecalculated at the parent level; they are not aggregated.The IsCalculated and UseLineItems attributes do not applybecause data for dynamic accounts is calculated, not stored.

    Hyperion Rules Student Guide || BISP || Amit Sharma || Created by : RupamMajumdar Page 14

  • 7/28/2019 Hyperion 11Rule2BISP

    15/22

    http://learnhyperion.wordpress.com

    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 aggregatedfrom children.

    Period-to-date views calculate correctly.

    Sub Dynamic ProceduresYou use Sub Dynamic procedures to create rules for dynamicaccounts.

    SyntaxSub ProcedureName()Type your Dynamic rule hereEnd Sub

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

    Hyperion Rules Student Guide || BISP || Amit Sharma || Created by : RupamMajumdar Page 15

  • 7/28/2019 Hyperion 11Rule2BISP

    16/22

    http://learnhyperion.wordpress.com

    Creating Rules for Dynamic Accounts

    You use the HS.Dynamic function to create rules for dynamicaccounts.

    You can use HS.Dynamic only in Sub Dynamic procedures.

    HS.Dynamic is executed for the current Point of View forEntity, Scenario, and Year.

    You cannot use conditional statements with dynamic rules.

    Hyperion Rules Student Guide || BISP || Amit Sharma || Created by : RupamMajumdar Page 16

  • 7/28/2019 Hyperion 11Rule2BISP

    17/22

    http://learnhyperion.wordpress.com

    Dynamic account values are calculated on the fly as data isrequested from Sub Dynamic procedures. You use theHS.Dynamic function within the procedures to create rules fordynamic accounts.

    SyntaxHS.Dynamic "DestPOV = Expression"Guidelines: The right side of the equation (source) cannot reference theScenario, Year, or Entity dimensions. Only dynamic accounts and View dimension members are validon 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, thecalculation isexecuted for all views. If you specify the View dimension, thecalculation is executed only for the specified view. You cannot use conditional statements within Sub Dynamicprocedures. Statements in Sub Dynamic procedures are executedsequentially.

    The HS.Dynamic function can reference data only in the currentsubcube. If you want to reference data from a different subcube,you may need to create a "parking" account to store informationfrom the other cube. For example, to reference a prior year's datain the formula, create a memorandum account to store last year'sdata in the current years subcube and reference thememorandum account in the dynamic calculation.

    Hyperion Rules Student Guide || BISP || Amit Sharma || Created by : RupamMajumdar Page 17

  • 7/28/2019 Hyperion 11Rule2BISP

    18/22

    http://learnhyperion.wordpress.com

    The table lists the expected results for the GMPercent account,assuming the Product custom member is the parent of P1, P2 andP3. Notice that Product custom member is calculated by theformula; it is not aggregated from its children.

    You can include the View dimension on the left side of the equalsign as the destination to limit the calculation to a specific view.In this example, the GMPercent calculation is executed only if youset the Point of View to periodic.

    Creating Custom Sub Procedures

    In addition to using the eight predefined Financial ManagementSub procedures, you can define custom Sub procedures. You canexecute, or call, custom procedures from within the predefined

    Hyperion Rules Student Guide || BISP || Amit Sharma || Created by : RupamMajumdar Page 18

  • 7/28/2019 Hyperion 11Rule2BISP

    19/22

    http://learnhyperion.wordpress.com

    Financial Management procedures or from another customprocedure.Custom Sub procedures ease organization and maintenance ofrules files. Instead of working with a single procedure that may

    contain hundreds of lines of script for different tasks, you cancreate multiple Sub procedures, each of which performs a singletask.When you define a custom Sub procedure, you can specify one ormore variables to receive values passed from the callingprocedure.

    Custom procedures provide these benefits:

    They make rules files easier to read.

    They simplify troubleshooting by separating script intological units.

    They allow rules to be reused by multiple calling procedures.

    SyntaxSub ProcedureName (Var1,Var2,Var3,...)......End Sub

    Arguments

    Hyperion Rules Student Guide || BISP || Amit Sharma || Created by : RupamMajumdar Page 19

  • 7/28/2019 Hyperion 11Rule2BISP

    20/22

    http://learnhyperion.wordpress.com

    ProcedureName The name of the procedure(Var1,Var2, Var3,...) :A list of variable names to receive valuespassed from the calling procedure.

    Calling Custom Sub ProceduresTo call a Sub procedure, you use the call keyword followed by theSub procedure name and parentheses, with values to be passed,if any, within the parentheses. Alternatively, you can omit the callkeyword and simply use the Sub procedure name.

    Creating Custom Function Procedures

    Function procedures perform an operation and return the result ofthe 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 tothe Function procedure. The Function procedure might thenconcatenate the two text strings and pass the concatenatedstring back to the calling procedure as a return value.

    Hyperion Rules Student Guide || BISP || Amit Sharma || Created by : RupamMajumdar Page 20

  • 7/28/2019 Hyperion 11Rule2BISP

    21/22

    http://learnhyperion.wordpress.com

    FunctionFunction FunctionName (Var1,Var2, VarN,...)...FunctionName=ReturnValue...End Function

    ArgumentsFunctionName

    The name of the Function procedure Var1,Var2, VarNA list of variable names that receive values passed from thecalling procedure

    ReturnValue

    The return value for the function (a literal value or an expressionthat returns a value.)

    Calling Custom Function ProceduresTo call a function, place the function name at the location in thescript where you want to insert the return value. When passingvalues to the variables, use the same syntax as for Subprocedures.

    Hyperion Rules Student Guide || BISP || Amit Sharma || Created by : RupamMajumdar Page 21

  • 7/28/2019 Hyperion 11Rule2BISP

    22/22

    http://learnhyperion.wordpress.com

    Hyperion Rules Student Guide || BISP || Amit Sharma || Created by : RupamMajumdar Page 22