Contextual Functions & Variables

Certain Functions and Variables are only present in particular parts of the application and are detailed below:

 

Node Functions

Node Functions (GetChild, GetFirstChild, GetLastChild, GetNextSibling, GetParent, GetPreviousSibling) extend the GetValue and GetText functions to look at records other than the current node (for which the code name is CurrentNode).

A "Sibling" is a Node that is at the same Level, a "Parent" is a Node above and a "Child" is a Node below. "Previous" refers to an earlier Index and "Next" refers to a later one. There are several key points to note when using these Node Functions.

  1. A GetValue(Field, Node) can return a Value at a higher level than the leaf. When this is the case, for example:
    GetValue(ImportedVolume,GetParent())
    then an aggregation must be set on the Field called in order to return a value.
  2. You can stack several Node Functions together to move around your Table. See the image below for some examples.
  3. It is possible for a Node Function to return a "null" result. For example:
    GetPreviousSibling(GetFirstChild())
    will return a "null" or empty result which cannot produce a value. There are two ways to manage this: Either don't prepare for it (default) which will produce an error on your Field rather than a result. The second option is to ignore the error using the SkipErrors boolean overload and the ValueIfError overload for the GetValue. For example:
    GetValue(ImportedVolume,GetPreviousSibling(CurrentNode,True),999)

Contextual Functions & Variables (Top)

Node Grouping Functions

Node Groupings allow tasks to be worked using an arbitrary grouping of nodes which might be intended, for example, to target the highest grade, or work in a grouped order not specified by the level structure.

GetNodeGroupingKey and TableNodeGroupingKey functions can be used to return the NodeGrouping Key for the current table or a specified table, respectively.

GetNodeGroupingKey

GetNodeGroupingKey(NodeGrouping nodeGrouping)

Retrieves the evaluated node grouping key from the current node's specified Node Grouping.

GetNodeGroupingKey(NodeGrouping nodeGrouping, [Node node])

Retrieves the evaluated node grouping key from the specified node's Node Grouping.

GetNodeGroupingKey(NodeGrouping nodeGrouping, [Node node], [string ValuefError])

Retrieves the evaluated node grouping key from the specified node's Node Grouping or the ValueIfError if an error is encountered.

TableNodeGroupingKey

TableNodeGroupingKey(String table, NodeGrouping nodeGrouping, Node node, [string ValueIfError])

Retrieves the evaluated node grouping key from the specified Table, Node Grouping and Node or the ValueIfError if an error is encountered.

Aggregation

Node Grouping Aggregation functions can be used in expressions to provide various field summaries (for the current table or a specified table) and are listed below:

CountOfGroup

CountOfGroup(NodeGrouping grouping, String groupValue, Field fieldToCount, string ExpectedValue, [float safeValue])

Retrieves the Count of the nodes that match the GroupValue from the current table's NodeGrouping and the ExpectedValue from the Field to count.

e.g. CountOfGroup(A,”B”,C,”D”) → Get the count of nodes that are in the current table, where their value in NodeGrouping A is equal to “B” AND their value for field C, when converted to string, is equal to “D”.

TableCountOfGroup

TableCountOfGroup(String table, NodeGrouping grouping, String groupValue, Field fieldToCount, string ExpectedValue, [float safeValue])

Retrieves the Count of the nodes that match the GroupValue from the specified Table's NodeGrouping and the ExpectedValue from the Field to count.

MaxOfGroup

MaxOfGroup(NodeGrouping grouping, String groupValue, Field fieldToMax, [float safeValue])

Retrieves the Maximum of a Field on all nodes that return the GroupValue from the current table's NodeGrouping.

TableMaxOfGroupBool

TableMaxOfGroupBool(String table, NodeGrouping grouping, String groupValue, String fieldToMax, [float safeValue])

Retrieves the Maximum BooleanValue of a Field on all nodes that return the GroupValue from the specified Table's NodeGrouping.

TableMaxOfGroupDate

TableMaxOfGroupDate(String table, NodeGrouping grouping, String groupValue, String fieldToMax, [float safeValue])

Retrieves the Maximum Date Value of a field on all nodes that return the GroupValue from the specified table's NodeGrouping.

TableMaxOfGroupValue

TableMaxOfGroupValue(String table, NodeGrouping grouping, String groupValue, String fieldToMax, [float safeValue])

Retrieves the Maximum Numeric Value of a field on all nodes that return the GroupValue from the specified table's NodeGrouping.

MinOfGroup

MinOfGroup(NodeGrouping grouping, String groupValue, Field fieldToMin, [float safeValue])

Retrieves the Minimum of a Field on all nodes that return the GroupValue from the current table's NodeGrouping.

TableMinOfGroupBool

TableMinOfGroupBool(String table, String grouping, String groupValue, String fieldToMin, [float safeValue])

Retrieves the Minimum Boolean Value of a field on all nodes that return the GroupValue from the specified table's NodeGrouping.

TableMinOfGroupDate

Retrieves the Minimum Date Value of a field on all nodes that return the GroupValue from the specified table's NodeGrouping.

TableMinOfGroupDate(String table, NodeGrouping grouping, String groupValue, String fieldToMin, [float safeValue])

TableMinOfGroupValue

TableMinOfGroupValue(String table, NodeGrouping grouping, String groupValue, String fieldToMin, [float safeValue])

Retrieves the Minimum Numeric Value of a field on all nodes that return the GroupValue from the specified table's NodeGrouping.

SumOfGroup

SumOfGroup(NodeGrouping grouping, String groupValue, Field fieldToSum, [float safeValue])

Retrieves the Sum of a Field on all nodes that return the GroupValue from the current table's NodeGrouping.

SumProductOfGroup

SumProductOfGroup(NodeGrouping grouping, String groupValue, Field field1, Field field2, [float safeValue])

Retrieves the Sum Product of two specific fields on all nodes that return the GroupValue from the current table's NodeGrouping.

e.g. (NodeA/Field1 * NodeA/Field2) + (NodeB/Field1 * NodeB/Field2), etc.

TableSumOfGroup

TableSumOfGroup(String table, NodeGrouping grouping, String groupValue, String field, [float safeValue])

Retrieves the Sum of a Field on all nodes that return the GroupValue from the specified Table's NodeGrouping.

TableSumProductOfGroup

TableSumProductOfGroup(String table, NodeGrouping grouping, String groupValue, String field1, String field2, [float safeValue])

Retrieves the Sum Product of two fields on all nodes that return the GroupValue from the specified Table's NodeGrouping.

Design Element Functions

Design Element functions can be used to retrieve the properties of design elements. These functions take a (shape or layer triangulation) design element as input and return the associated value (provided the types match).

Shapes

GetShapeLength(CurrentElement)
GetShapeArea(CurrentElement) 
GetShapeCentroid(CurrentElement)
GetShapeAverageZ(CurrentElement)
GetShapeMinGradient(CurrentElement)
GetShapeMaxGradient(CurrentElement)
GetShapeAzimuth(CurrentElement)
GetShapeMinXYZ(CurrentElement)
GetShapeMaxXYZ(CurrentElement)

Layer Triangulations

GetShapeVolume(CurrentElement)
GetShapeMinXYZ(CurrentElement)
GetShapeMaxXYZ(CurrentElement)

For example:

If(GetShapeArea(CurrentElement) > 15000,True,False)

or

GetZCoordinate(GetShapeMaxXYZ(CurrentElement))

to assign the max Z to an attribute as shown below:

Solid Field Functions

Solid Field functions can be used to retrieve the properties of calculated and non-calculated solid fields. For example:

GetSolidMaxXYZ(Field)

Solid field functions:

GetSolidCentroid(Field)
GetSolidMinXYZ(Field)
GetSolidMaxXYZ(Field)
GetSolidVolume(Field)
GetSolidAreaofHull(Field)
GetSolidAreaofTriangles(Field, DipDegrees)
GetSolidThickness(Field)
GetSolidThickness(Field, GridXCount)
GetSolidThickness(Field, GridXCount, UseTopQuarter)

Contextual Functions & Variables (Top)

Table Plots: Data Functions

(NodesSum, NodesWeightAvg, NodesMin, NodesMax)

Because Table Plots often rely on groups of Leaves to provided aggregated results (e.g. Strip Ratios are a combination of all Waste divided by all Coal in a vertical group of Leaves) GetValue type Functions needs to be wrapped in a Nodes Function to correctly aggregate the results. This is because there will be examples where you want NodesSum(e.g Strip Ratios), NodesWeightAvg (e.g Quality Plots) and NodesMin/Max (e.g. Period Progress Plots).

Custom Fields: Source Percentage Completed

When creating Custom Fields, it's important that Value Custom Fields that are Aggregated by Sum are also multiplied by the SourcePercentageCompleted variable to ensure they are not over-represented.

SourcePercentageCompleted and other "Common Value" variables can be easily inserted into an expression. For more information, see: Options

Contextual Functions & Variables (Top)