This guide has been produced to provide instruction to adding expressions and logic to a block model field.
The Reserve Model Generator can be found while editing Reserve Models in Rapid Reserver's Setup under Block Model and Edit.
Rapid Reserver > Setup > Block Model > Edit
This is where you will gain access the Reserve Model Generator that will allow you to add in new fields with it's corresponding parcel mappings. There are two different methods, Inline Formula and Custom Variable.
Inline Formula
To define different properties you can write an inline formula using "IF" statement, such as If N("Fe") is greater than 60 return "hg" otherwise if N("Fe") is greater than 58 return "mg" otherwise if N("Fe") is greater than 57.5 return "lg1" otherwise if N("Fe") is greater than 56 return "lg2" otherwise if N("Fe") is greater than 50 return "minw" otherwise call it "waste".
However, with these inline formulas, it can be long and confusing. Therefore, if there are multiple properties and parcel types that need to be separated, it is recommended to use Custom Variables.
Block model with Inline Formula - IF Statement
For more block model formulas and logical operators, please view the list found below.
| Block Model formulas | |
| A+B | Add A and B |
| A-B | Subtract B from A |
| A*B | Multiply A and B |
| A/B | Divide A by B |
| A.ToLower() | Convert all upper case text (HG, Hg, hg) into lower case |
| Math.Min(A,B) | Return the minimum of A and B |
| Math.Max(A,B) | Return the maximum of A and B |
| N("density") <= 0 ? 0 : N("volume") | If density is less than or equal to zero, return zero volume, else return the volume field |
| A.Substring(0,Math.Min(3,A.Length)) | Return the first three letters of A |
| ( RowT("material") == "waste1" || RowT("material") == "waste2") ? "waste" : RowT("material") | If material is waste1 or waste2, then return "waste", else return the "material" |
| && | And |
| || | Or |
| == | Equal to |
| != | Not Equal to |
| > | Greater than |
| >= | Greater than or equal to |
| < | Less than |
| <= | Less than or equal to |
Custom Variables
Custom variables allow us to write complex logic in a readable and reusable way, which can then be mixed with other inline formulas in the block model mappings. Below is an example of the same inline formula but as a custom variable. Note that Alastri's script editor is based on a C# scripting language.
Custom Variable Script Editor - Example
Creating a Custom Variable
- Within the Reserve Model Generator, click Custom Variables to open the Script Editor.
- Clear all the text from the Script Editor and replace it with several sample codes in the follow link. Examples will be found in the section "Custom Variables Examples".
- Once completed, in the list of available variables on the right you will see a new variable CustomT("Parcel") in bold. This can be mapped it to the Parcel field.
Assigning Custom Variable to Reversable Model Generator
Want to learn more?
Online Help Manuals - Click here for the latest version
Learning Management System - Click here to login or here to request access
Comments
0 comments
Please sign in to leave a comment.