Declaring a cross reference file for a report

!xfile

Declare a cross reference file for a report


SYNTAX

!xfile file_id [index = index_id] key = expr_list

Declare a cross reference file. The file is read automatically, using the key fields specified, by the report driving logic at the start of each cycle. If it is closed, it is automatically opened.

The run time report_mode property may be used to specify that !xfile opens records in read-only mode even if the file is open in update mode.

file_id

The file_id must be the identifier of a file declared in the main program (before the !report section) by ![o]file.

[index = index_id]

This clause may be used to specify a secondary index of the cross reference file, rather than the main file. The index_id must be the name of a secondary index defined for the main file. The ddeditor program is used to define data dictionaries and their secondary indexes.

key = expr_list

The expr_list constitutes the key by which the cross-reference file record is to be read. The key = clause has the syntax:

key = expression [, expression]…

The data in the first expression listed is assigned to the first key field of the record, the data in the second to the second key field and so on. Standard rules of assignment are used. If the number of expressions listed is fewer than the number of file key fields, the extra keys are set blank. If the number of expressions listed is greater than the number of file key fields, the extra expressions are discarded.

See The key = clause.

If there is no record in the cross reference file which is an exact match for the key fields provided, a blank record is returned.


EXAMPLE

!drive Patients
!xfile History key = Patients.refno
!heading {
     printh *Patients.refno, *Patients.surname; *Patients.fname; *History.nvisits
}

!final {
     print "The truth is out there somewhere"
}

RELATED TOPICS

Reports

!drive

![o]file