OnDemand Rules in HFM

In Version 11.1.2.2 OnDemand Rules were introduced. This is the ability to execute a ‘Calculate’ type Rules procedure from a web form. They are documented in the Administrator Guide for V11.1.2.3:

On-demand rules are used in Data Forms, and enable you to run a subset of calculations to quickly see the results in the data form. All HS functions that can be used in Sub Calculate (but no others) can also be used in OnDemand rules.

This means that you can run a section of the Rules file without running the complete calculation. This feature comes from Planning where calculations bring in data from, for example, Workforce Planning and I have struggled to see how it could be of any use for HFM. In Planning you are dealing with discrete blocks of data held in different plan types while HFM has just the one Chart of Accounts. The calculation time for a single entity in HFM is usually less than a minute so the benefit of being able to calculate just a subset when there are dependencies on the data is doubtful. Oracle’s QMR and Tax Provision applications both use OnDemand Rules but you need to design the application carefully if you are going to use OnDemand Rules for copying data. If the OnDemand Rules are not called by the Calculate routine, any intersections that are updated must not be calculated because they will be cleared when Calculate is next executed. Admin Guide again:

Also note that unlike Sub Calculate, data previously written to an IsCalculated data-point is not cleared when an On-demand rule is run.

There is no point in changing calculated data in OnDemand Rules because it will be overwritten when Calculate is executed. If you change the data in the subcube when executing OnDemand Rules, the calculation status changes. So this leaves us with either changing input data or running a process that does not actually change the data such as extracting data. You could use OnDemand Rules for creating a starting point for Budget by copying in data from a previous period or year. If you use SmartView for data input, a common problem is that zeroes are saved as input data. It occurred to me that the OnDemand Rules could be used for administration tasks such as removing input zeroes. A simple OnDemand Rule can be used to clear intersections where the data value is zero:

Sub OnDemand_Clear()
Dim objDataUnit
Dim numItems, numItemCounter
Dim strAcc, strC1, strC2, strC3, strC4, strICP, numData

'Open a dataunit for all the data in the subcube
Set objDataUnit = HS.OpenDataUnit("")
'get the number of records in the dataunit
numItems = objDataUnit.GetNumItems()
'Read through each record
For numItemCounter = 0 To numItems - 1
'Get the data value for the record
numData = objDataUnit.Item(numItemCounter).Data
'If the data value is zero
If numData = 0 Then
'Get the member information
strAcc = objDataUnit.Item(numItemCounter).Account
strICP = objDataUnit.Item(numItemCounter).ICP
strC1 = objDataUnit.Item(numItemCounter).Custom("C1")
strC2 = objDataUnit.Item(numItemCounter).Custom("C2")
strC3 = objDataUnit.Item(numItemCounter).Custom("C3")
strC4 = objDataUnit.Item(numItemCounter).Custom("C4")

'Clear the intersection
HS.Clear "A#" & strAcc & ".I#" & strICP & ".C1#" & strC1 & ".C2#" & strC2 & ".C3#" & strC3 & ".C4#" & strC4
End If
Next

End Sub

Notice the name of the procedure begins with OnDemand_. You can choose whether to call these OnDemand procedures from the Calculate procedure or not.

Now you can add this OnDemand Rule to a web form:
FormDetails

You can either type in the OnDemand Rule name or click on the selection box.
OnDemandRulesSelection
Notice you can have more than one OnDemand Rule on the same web form.

Now when you open the web form you will get an extra icon on the toolbar in the Calculate section:
WebFormToolbar

And it is also available from the right-click menu:
RightClickMenu

OnDemand Rules are not of much value as a means of executing a small portion of the Rules file. However, they can add value if they are used for occasional admin or data tasks.