Inquisitor
Record Variable
The Record Variable gets set by the RECORD_STATEMENT. There are various ways that this variable can be accessed. Some of the possible syntax are already shown in the examples of the PRINT statements (see the Record Statement section). In this section the aspects of the internal storage of the record variable are addressed.
The naming structure of the variable is fairly obvious, a ‘$’ char followed by one or more alphanumeric characters; there is no practical limit to the number of characters that can be used (note that Inquisitor is case sensitive).
The Record Statement section dealt with setting the record variable. One note of warning though, you cannot use the same record variable to query more than one type of record. The example below would be illegal and not allowed.
$HOLE := HOLEID: (BHNAME == '*') $HOLE := LITHO: (ROCK == 'Porphyry')
The following example however is legal, but not recommended because it is confusing as to what is being tested and to which LITHO record the variable refers:
$ROCK_SECT := LITHO: (ROCK == 'Porphyry ') $ROCK_SECT := LITHO: (TOP > 100.0)
These two lines would in fact do the following:
- Test that the rock type of a LITHO record was Porphyry, and if it passed this test,
- It would then check the NEXT record to see if it was below 100.0m depth.
To do both tests on the same LITHO record, the tests must occur in the same logical expression; for example,
$ROCK_SECT := LITHO: ((ROCK == 'Porphyry') && (TOP > 100.0))
When using the record variable contents, it is referenced by name:
$ROCK_SECT
which refers to the current record of the type of record queried. However, the record variable also has an array like structure, so that records other than the current record can be referenced; for example, by using the following sort of structure:
$ROCK_SECT[PREVIOUS]
This would reference the LITHO record immediately prior to the current record. It would reference this record irrespective of whether the record had passed the test in the logical expression of the RECORD_STATEMENT querying it.
There are several valid entries that can be used between the square brackets in this type of array reference. The following table lists these and their meanings.
| Entry | Description |
| CURRENT | The current record, irrespective of whether it passed the test in the record statement. This construct is identical to just using the ${name} construct without the [...]. |
| PREVIOUS | The previous record to the current record, irrespective of whether it passed the test in the record statement. |
| FIRST_MATCH | The first record in the list that passed the test in the record statement. |
| PREV_MATCH | The record prior to the current record that passed the test in the record statement. |
| A{INTEGER} | The absolute record number in the list, irrespective of whether it passed the test in the record statement; for example, $ROCK_SECT[A3] would be the third instance of a LITHO record. N.B. the INTEGER must be greater than zero. However, there is one special construct; $ROCK_SECT[A0], which means the current MATCHING record, that is, the LAST record which passed the test in the record statement (N.B. this may be the current record). |
| {INTEGER} | The relative record number offset from the current record, irrespective of whether it passed the test in the record statement. E.g. $ROCK_SECT[3] would be three rock section records above the current. $ROCK_SECT[0] is equivalent $ROCK_SECT or $ROCK_SECT[CURRENT]. |
Table 5 - Array Reference Entries
Care should be taken when referring to any offset of the record variable, other than the current, in case it does not exist. We therefore recommend using a test to ensure that a record (or a suitable record) exists. In all cases, if a record variable is used as a logical expression, it will return a.TRUE. if it exists, or a.FALSE. if not. Thus, an IF_STATEMENT (see the Reference section) can be used to check on the contents of the variable before operating upon it; for example,:
IF ($ROCK_SECT[PREVIOUS]) THEN.....
will only return.TRUE. if there is a previous record to the current record, and
IF ($ROCK_SECT[PREV_MATCH]) THEN.....
will only return.TRUE. if there is a previous record which passed the test in the RECORD_STATEMENT.
Obviously, most accesses to a record will be to access information held in the fields of that record. To access a field in the record variable, the syntax is:
RECORD_ID : ID
(as shown by the syntax table). So, to access the GOLD field from a LITHO type record held in the $ROCK_SECT variable the following syntax would be used:
$ROCK_SECT:GOLD
and to get the same field from the previous LITHO record held by $ROCK_SECT, the following syntax would be used:
$ROCK_SECT[PREVIOUS]:GOLD
Examples of these constructs have been used in the PRINT_COMMANDs shown in some of the example scripts in the Record Statement section.