Results #3: Custom Fields & The Expression Generator

Click to Print

Conceptual

In the previous section we discussed the concept that an Output Schedule is the building block for all other reporting and that over 50 data items are available by default. It’s also possible to use any information from the Output Schedule (and also from your Data Tables) to build custom results, known in Spry as Custom Fields. There are two distinct types of Custom Fields:

  • Value Type: Returns a numeric value results3custom
  • Filter Type: Returns a text value results3custom1

The basic principle is that a Value Type Custom Field will return numbers and Filter Type Custom Fields will return strings. Want to calculate an operating cost? Multiply your operating hours by your hourly cost in a Value Type. Want to group multiple benches together to create broader groups like low, medium and high material? A Filter Type will filter those benches into their relevant material height string.

Custom Fields are the result of an Expression. You can consider an Expression to be a formula similar to an Excel formula. The Practical section below will detail several examples as well as where to find the full set of tools available to you.

Custom Field Limitations

It’s important to know that Custom Fields can only be calculated on a “per line of the Output Schedule” basis. This means that although Custom Fields can be aggregated individually, they cannot be an aggregated calculation (such as Strip Ratio). You can still calculate Strip Ratios in Spreadsheets discussed in the next section!

Constants vs Variables

It’s important to understand the difference between a Constant and a Variable when dealing with the Expression Editor. A Variable is anything that might change when you run your Scenario (any item that might appear in a line of the Output Schedule). In contrast Constants don’t change when you run your schedule. A simple example of that in practice is that the Equipment you set up in your Scenario is a Constant, but the Equipment in a line of the Output Schedule line is a Variable. For clarity, check some more examples below.

results3custom2

results3custom3

You’ll use quite a lot of “if the variable is this constant then do this”. So if you were saying if the Process is Waste you would write that as Process=ProcessWaste. There are plenty of examples to help you get started so don’t get too caught up on it right now.

Code Names

The final thing to note before getting started with your first Custom Field is a basic understanding of how the nomenclature works, especially relating to Constants which use Code Names. You might have a piece of Equipment named Blasting, but you might also have a process called Blasting. You can’t just use Blasting as the name for each as they have to be unique, so Spry places their location before the name, so the piece of Equipment called Blasting has the Code Name EquipmentBlasting (no spaces) and the Process is called ProcessBlasting. To see the full range of Code Names available to you scroll through the dropdown in the Expression Editor.

Practical

Create a new Custom Field by right-clicking “Custom Fields” and choosing New -> Custom Filter/Value Field Type

Expression Type

(Default: Single) Determines whether your Expression will be conditional on the Process or Equipment

results3custom4

Format String

The Format String controls the way the data appears, but doesn’t affect the data itself. The Format String nomenclature is based on C# standards and a summary is available in Appendix #1: Format Strings.

Aggregation

(Default: Sum) How the data will be aggregated when filtered (typically Sum when dealing with quantities). For information on how aggregates can work visit http://en.wikipedia.org/wiki/Aggregate_function

Expression (Filter OR Value)

Use the image below to help with the explanations that follow.

results3custom5

There are four kinds of Expression Items (1) in Spry.

Functions are very similar to what you use in Excel. There are over 100 functions built into Spry, and remembering what they all do is impossible. You can make things simpler by using the dropdown menu (4) and the description (3).

results3custom6

Operators are a symbol or function denoting an operation (e.g. ×, +) and also include logical functions (e.g. And/&& and Or/||)

results3custom7

Constants, discussed in some detail in the Conceptual section, are Spry data items that don’t change when your Scenario runs. The include Equipment, Processes and relevant Table Positions and Fields.

results3custom8

Variables are Spry data items that are effected by the running of a Scenario.

results3custom9

Examples

Simple Coal Value: If you’re scheduling in Volume but want to report Tonnes, or vice versa, you would use the GetValue() Function to draw the Constant from the table, and multiply it by the Source Percentage Completed.

results3custom10

Equipment Cost: This example shows a Per Equipment Value Type.

results3custom11

Volume: This example shows a Per Process Value Type.

results3custom12

Unit Equipment Cost

results3custom13

Using an existing custom field as a Value Expression (Add all Volume over 3km)

results3custom14

Filter Type Bench Grouping Example: The example below will group Benches below RL 0 as Low, 0-50 as Mid and 55+ as High.

results3custom15

If(Between(SourceBench,SourceBenchN85,SourceBenchN5)=True,"Low",
If(Between(SourceBench,SourceBench0,SourceBench50)=True,"Mid","High"))