I have a series of Ratios calculated in VBScript which incorporates the total days in the year. For 2016 we need to utilize "366" days instead of the normal "365."
I created a Dim variable to populate based on the year, but it's clear the script isn't working and instead zeros out.
VBScript:
'/ Adding YrDays to account for Leap Years'/
If POV_Year = "2012" OR "2016" OR "2020" OR "2024" OR "2028" Then
YrDays = "366"
Else YrDays = "365"
End If
HS.Exp "A#Ratio007.C1#[None]" & DynC1 & " =
((A#Tohinc" & Tops & " * (YrDays / A#numberdays.E#PVTB Admin))
/ (A#Totass" & Tops &")) * 100"
When I upload the Business Rules into Oracle HFM, the VBScript uploads without errors but fails to calculate the ratio.
There is no account in HFM for YrDays as I want to calculate the value (YrDays) during the consolidation and calculation. I've verified POV_Year, Numberdays, and other values are loading properly.
Any idea what I might be doing wrong?
Software: Oracle HFM 11.1.2.3.500 VBScript Rule.rle file editing in Notepad++
Edit: This is the solution I went with:
'/ Adding YrDays to account for Leap Years'/
SELECT CASE POV_YEAR
CASE "2012", "2016", "2020", "2024", "2028"
YrDays = 366
Case Else
YrDays = 365
End Select
I also needed to change the way YrDays was referenced in the formula, I should have known it needed to be in Quotation marks to be referenced in the calculation.
HS.Exp "A#Ratio007.C1#[None]" & DynC1 & " =
((A#Tohinc" & Tops & " * ("& YrDays & "/ A#numberdays.E#PVTB Admin))
/ (A#Totass" & Tops &")) * 100"