![]() | Referencing Hierarchy Data | Referencing the hierachy via JavaScript | ![]() |
Syntax: @Assign <numeric> = Rollup(<hierarchy>,<cost property>,<quantity property>)
The Rollup function provides the facility to total up costs in the hierarchy taking account of quantities. The function can be used within the OnHierarchyExit event of an object or it can be used outside the hierarchy, for instance in the main agenda.
i) If the function is used within the OnHierarchyExit event then the rolled up cost can be assigned to a suitable property of the object itself (using the reserved word 'Self')…
@Assign Self.Unit_Cost = Rollup(Self,Item_Cost,Quantity)
This approach can be used to generate totals at all levels of a hierarchy.
ii) On the other hand, if the function is used outside the hierarchy only the overall cost can be obtained…
@Assign Total_Cost = Rollup(Hierarchy1,Item_Cost,Quantity)
In both approaches when using the Rollup function it is necessary to add the cost properties and the quantity properties to the Subassembly base class.