Inquisitor

Exec Statements

After performing a query to find records, and calculate the values wanted, it is of little use if you can’t do anything with them. The EXEC_STATEMENTs provide the means of acting upon the information determined by Inquisitor. It might be reporting the information, or manipulating the database on the basis of the information, or both.

Currently, the structure of the Inquisitor script requires that the execution part of any of the four possible sections of the script comes after the querying/data part. The first EXEC_STATEMENT signifies the end of STATEMENTs (the searching part), and no other STATEMENTS will be allowed in that section.

There are currently three types of execution statements available in Inquisitor. These are:

  • PRINT
  • FIELD_CALC
  • RECORD_DELETE

They are described in detail below.

PRINT
This is used by Inquisitor to output information in the form of a report. It allows printing of information to the output file specified at the prompt when starting up the Inquisitor executable (see the Installing and Running Inquisitor section). The syntax of the command is:

			PRINT [ ATOM [FORMAT] ]*

where ATOM = RECORD_FIELD | LITERAL | DATA_ID | ARITH_EXPR | STRING_EXPR | LOG_EXPR.

The print statement can consist of just a simple PRINT, in which case a blank line is output. Normally though the statement would consist of PRINT followed by one or more atoms of any type. Each atom can be formatted with an optional FORMAT clause if required. If using format clauses, then it is not necessary to give all atoms a format, but it would be usual.

If format clauses are not used on the atoms, then each unformatted atom is separated from the others by the PRINT SEPARATOR character. By default, this character is set to the ASCII space character, but it can be set to any desired character; for example, a comma, or tab, to allow the output to be used by a spreadsheet. To change the PRINT SEPARATOR use the control statement QL_PRINTSEPARATOR (see the Control Statements section).

The format clause syntax is:

%[FLOAT | INTEGER]?[cdiefosux]1
		

This is C print format syntax (for example, %-10.2d) but unlike C it must follow immediately after the atom to be printed; for example, $ROCK_SECT:TOP%-10.2f (spaces between the atom and the % sign are allowed). The format clause must begin with a % sign, an optional numeric part follows, and a letter signifying the type of format. The numeric part, if used, consists of an optional minimum field width (in our example 10) and the optional decimal part, the precision (in our example.2). The item being formatted will be right justified in a space field width characters wide (if a negative number is used it will be left justified). For numeric items, the precision field specifies the number of decimal places to be displayed. For string items, the precision field specified the number of characters from the string to be displayed. The format types available are:

Table 9 - Format Types

Format Description
d,i The INTEGER argument is converted to decimal notation.
o The INTEGER argument is converted to unsigned octal notation (without a leading zero).
x The INTEGER argument is converted to unsigned hexadecimal notation (without a leading 0x).
u The INTEGER argument is converted to unsigned decimal notation.
c The argument is taken to be a single STRING character.
s The argument is taken to be STRING; characters are taken from the string until the end or until the number of characters specified by the precision (see above) are taken.
e The argument is taken to be a FLOAT and is converted to decimal notation in the form [-]m.nnnnnnE[+|-]xx where the length of n’s is specified by the precision. Default precision is 6.
f The argument is taken to be a FLOAT and is converted to decimal notation in the form [-]mmm.nnnnnn where the length of n’s is specified by the precision. Default precision is 6. N.B. the precision does not determine the number of significant digits.

Example PRINTs:

  1. Print a blank line
    PRINT
  2. Print a number of items separated by the PRINT SEPARATOR character
    PRINT $HOLE:BHNAME $ROCK_SECT:ROCK $PORP_ASSAY:GOLD  #THICKNESS 'Hello World' 99.0 #LOG_DATE
  3. Print a number of items formatted
    PRINT $HOLE:BHNAME%-10s $ROCK_SECT:ROCK%-20s  $PORP_ASSAY:GOLD%8.2f #THICKNESS%8.2f #NAME%.10s
  4. Print a mixture of formatted and character separated items
    PRINT $HOLE:BHNAME%-10s $ROCK_SECT:ROCK%-20s  $PORP_ASSAY:GOLD%8.2f #THICKNESS 'Hello World' 99.0%8.2f  #LOG_DATE

FIELD_CALC
This command allows the contents of fields in a record on the database to be modified. The syntax of the command being:FIELD_WRITERECORD_FIELD := ATOM

where ATOM = RECORD_FIELD | LITERAL | DATA_ID | ARITH_EXPR | STRING_EXPR | LOG_EXPR

This will update the record on the database, which is indicated by the record variable, immediately upon execution of the command. The record to update and field to change is specified by the RECORD_FIELD (any of the records in the record variable can be modified; that is, the [POS] positioning option can be used). Note that the atom only has to be surrounded by brackets if it is a complex expression.

Example FIELD_WRITEs:

  1. Calculate a thickness from successive floors and update a thickness field.
    #THICKNESS := ($ROCK_SECT:BASE - $ROCK_SECT[PREVIOUS]:BASE) FIELD_WRITE $ROCK_SECT:THICK := #THICKNESS

    or alternatively just

    FIELD_WRITE $ROCK_SECT:THICK := ($ROCK_SECT:BASE - $ROCK_SECT[PREVIOUS]:BASE)
  2. Set the total depth of hole from the base of the last lithology found
    FIELD_WRITE $HOLE:TD:= $ROCK_SECT[A0]:BASE
  3. Set the default value of an assay to -999.00
    FIELD_WRITE $ASSAY:GOLD:= -999.00

RECORD_DELETE
This command allows records to be deleted from a database. The command syntax being:DELETE_RECORDRECORD_ID[POs]

This will delete the specified record on the database, which is indicated by the record variable, immediately upon execution of the command.

Example DELETE_RECORDs:

  1. Delete the first lithology record
    DELETE_RECORD $ROCK_SECT[1]
  2. Delete the current assay record
    DELETE_RECORD $PORP_ASSAY