XPAC Reference Guide

Constraints

Constraints

Previous topic Next topic  

Constraints

Previous topic Next topic  

In the Range Selection window, it is possible to include and exclude any database record for the range. When the records to be included/excluded are upper level records, it is quite easy to manually tick the required records in the tree. However, when the records to be included and excluded are lower level records, in a large database and distributed randomly throughout the database, then the process is more complex. In this case, database constraints are used to simplify the process. A database constraint can be a simple one line XCM type statement, or a complex XCM script.

Some examples of simple database constraints are provided below. They should be read as "If the constraint is true for the record, then it should be included in the range".

GetApil(4) = 5
M(mROM_Coal_Thk) <= 2
GetClass(mPrd_Type) = "Sulphide Ore"
GetRecName(CURRENT, RECORDNAME) = "Quarter 2"

And and Or statements can be used to join statements such as these. However, if the constraint becomes complex and takes up multiple lines, it may be better to place it in an XCM script.

Adding a constraint to a range

To assign a constraint to a range you should go to the Range Selection window and select the relevant range. Click Edit in the Constraint Box on the lower right of the window and the following window will be displayed:

Edit Range Constraint Window

If the constraint is a simple one line XCM conditional statement, select the Condition radio button and type the constraint in the white-space on the right.
If the constraint has been written into an XCM script, select the Script radio button, click Browse to select the XCM.
You can set the database level at which to run the script from the Scanning Level drop down list.

Click OK to save the constraint and return to the Range Selection window. The Constraint box will now display as follows. The blue text will display as None if there is no constraint assigned; Condition if an XCM conditional statement has been assigned, or Script if an XCM script has been assigned.