HFM - more than four customs

The devil's in the rules

Author: Rich House

 

I recently discovered whilst implementing a HFM 11.1.2.4 solution, a five custom dimensions application, that some HFM rules do not function when an application has more than four custom dimensions.

The “OpenDataUnit” rules have to be modified when you have more than the four standard Custom dimensions.

The purpose of the rule set:

To provide translated data in constant currencies.

Custom(4) “C4”| Custom(5) “C5” hierarchy extract:

          

The existing VB HFM rule script

If vScenario = "Actual" Then

 Set vDataUnit = HS.OpenDataUnit("C4#[None]")

                  vNumItems = vDataUnit.GetNumItems()

                  vBUD_RATE = HS.Custom4.IDFromMember("BUD_RATE")

                  HS.Clear "C4#BUD_RATE"                         

                  For i = 0 To vNumItems - 1

                  'Get the next item from the dataunit

                  Call vDataUnit.GetItemIDs2(i, vAccount, vICP, vCustom1, vCustom2, vCustom3, vCustom4, dData)

                                    If dData <> 0 Then

If HS.Account.C4Top(HS.Account.MemberFromID(vAccount)) = "RatesAnalysis" Then

                                                      Call HS.SetData(0, vAccount, vICP, vCustom1, vCustom2, vCustom3, vBUD_RATE, dData, False)      

                                                      End If       

                                    End If 'end of test for 0

                  Next

End If 'End of Actual scenario

 

Below is an alternative approach

The revised VB HFM rule script:

If vScenario = "Actual" Then

                  Set vDataUnit = HS.OpenDataUnit("C5#[None]")

                  vNumItems = vDataUnit.GetNumItems()

                  [ nBUD_RATE = HS.Custom4.IDFromMember("BUD_RATE") ] – NOTE THIS STATEMENT HAS BEEN REMOVED

                  HS.Clear "C5#BUD_Rate"

                  For i = 0 To vNumItems - 1

                                    'Get the next item from the dataunit

                                    Call vDataUnit.GetItemExtDim(i, vAccount, vICP, vCustom, dData)

                                    If dData <> 0 Then

If HS.Account.CustomTop(vAccount,"Custom5") = "RatesAnalysis" Then

HS.SetDataWithPOV "A#" & vAccount & ".I#" & vICP & ".C1#" & vCustom(0,1) & ".C2#" & vCustom(1,1) & ".C3#" & vCustom(2,1) & ".C4#" & vCustom(3,1) & ".C5#BUD_Rate", dData, False                 

End If       

End If 'end of test for 0

Next

End If 'End of Actual scenario.

 

The major changes to the functions are highlighted above in green.

  1. DataUnit.GetItem is modified to DataUnit.GetItemExtDim which is a 2-column array
  2. C4Top(HS.Account.MemberFromID(vAccount)) is modified to CustomTop(vAccount,"Custom5")
  3. SetData is modified to SetDataWithPOV
  4. The variable vCustom holds all the custom dimensions members
  5. Previously, the Exp functions were referencing the different custom dimensions member names and they are modified as follows:
    • vCustom1 is modified to vCustom(0,1) where the “0” defines the Custom1 dimension and the “1” defines the member name within it
    • vCustom2 is modified to vCustom(1,1) where the “1” defines the Custom2 dimension and the “1” defines the member name within it
    • vCustom3 is modified to vCustom(2,1) where the “2” defines the Custom3 dimension and the “1” defines the member name within it
    • vCustom4 is modified to vCustom(3,1) where the “3” defines the Custom4 dimension and the “1” defines the member name within it

 

I hope the above was useful!