Rolling up constituent values

Rolls up the parameter values of a constituent formula to the same parameters in the raw material item. In this example, the ConstituentRollup method is applied to a post-save script on the Formula Symbol > Script tab.

The script runs when a constituent formula is saved after being created or updated. The Save event occurs after the formula is calculated and its parameter values are updated by the standard rollup process.

This example adds “ObjectMethod” as the third argument.


Option Strict Off
Imports System
Imports System.Data
Imports System.Diagnostics

Class HookScript
  Inherits FcProcFuncSetEventHook
Function postsave() As Long
 Dim oRollup as Object = ObjMethod("", "", "ObjectMethod", "ConstituentRollup", "")
Return 1

End Function
End Class

This object method does not work properly in an equation because all of the item parameters are copied. Equations are part of the calc cycle. Therefore, the copy of the parameters cannot be performed until the calc cycle is over.

This object method can also be invoked from a workflow. If a workflow is running on the constituent formula, then the syntax is:


Dim rc As Object = ObjMethod("","","ObjectMethod", "CONSTITUENTROLLUP", 
"")

If the workflow is running on another object, then the symbol is the first argument. The key is the second. The rest of the arguments are always the same.


Dim rc As Object = ObjMethod("FORMULA","F1\0001","ObjectMethod", 
"CONSTITUENTROLLUP", "")

The Level column on the Item > Parameters tab is affected according to these rules.

Level before Constituent Rollup Update Level? Description
0 = Pending Yes Overwrite the item value with the value of the Constituent Formula.
1 = Manual Override No Do not change the parameter value.
2 = Calculated No Do not change the parameter value. Subsequent Save or Calc on the Item updates this value; the update is based on the parameter definitions.
3 = Derived from Constituents Yes Update the item value with the Constituent Formula