Opening
Retrieves the opening value for a specified, fully defined account (Account/C1/C2/C3/C4/ICP).
Return Value
This function returns a string of characters representing the correct expression to be used as part of the HS.EXP function.
Syntax
Opening (PointOfView, View)
Table 12-11 Syntax of Opening Function
Parameter | Valid Values |
---|---|
PointOfView |
Valid combination of Account, Custom1….4, ICP members, for example, "A#CLOSE.C1#[None].I#[ICP Top]" |
View |
Must be one of these values: "" (double quote) - Based on the default view defined for the scenario being processed (either YTD or Periodic). YTD - Specify the Year-to-date option, which overrides the default view set for the scenario. Periodic- Specify the Periodic option, which overrides the default view set for the scenario. |
Detailed Description
This function calculates the opening value of a specified account. The opening value is derived differently based on the View parameter.
-
If the View parameter is YTD, the opening value is retrieved from the last period of the prior year.
-
If the View parameter is Periodic, the opening value is retrieved from the prior period of the current year. If the current period is the first period of the year, the opening value is retrieved from the last period of the prior year.
-
If the View parameter is blank ( " " ), the opening value is based on the default data view of the scenario.
Example
The FA_COST account will return the following values for January, February, and March 2014 depending on the View parameters used in the Opening function. The default view set for the scenario being processed is YTD.
Table 12-12 Example of Opening Function
Account | Dec2013 | Jan2014 | Feb2014 | Mar2014 |
---|---|---|---|---|
A#FA_COST |
900 |
1,200 |
1,100 |
1,500 |
Opening("A#FA_COST" "") |
N/A |
900 |
900 |
900 |
Opening("A#FA_COST", "YTD)" |
N/A |
900 |
900 |
900 |
Opening("A#FA_COST", "Periodic") |
N/A |
900 |
1,200 |
1,100 |
Sample Script
' sample statement written in the calling routine
Sub Calculate()
Hs.Exp "A#Open_FA_Cost = " & Opening("A#FA_Cost", "YTD")
End Sub
' programming of the OPENING function
FUNCTION OPENING(strPOV,strVIEW)
IF strVIEW = "" THEN
strVIEW = HS.SCENARIO.DEFAULTVIEW ( "")
END IF
strPOV = UCASE(strPOV)
strVIEW = UCASE(strVIEW)
IF strVIEW = "PERIODIC" THEN
OPENING = strPOV &".P#PRIOR"
ELSEIF strVIEW = "YTD" THEN
OPENING = strPOV &".Y#PRIOR.P#LAST"
ELSE
EXIT FUNCTION
END IF
END FUNCTION