Contents: | Main | Chapter | See Also: | Getting Started Manual | Programmer Manual |
The most common form of relational navigation uses simple extended pointers. This type of navigation requires a pointer field to exist from the current file to another file. Using a pointer field from an entry in the current file, you can easily retrieve information from the pointed-to entry in another file.
For example, suppose you are printing a report from the PATIENT file. Further suppose that the PATIENT file has a pointer field called ATTENDING PHYSICIAN field to the DOCTOR file. Now, what if you wanted to include the phone number of the attending physician for each patient in your report from the PATIENT file? The attending physician's phone number is stored in the DOCTOR file, not the PATIENT file.
You can include the attending physician's phone number for each patient in your report, by using a simple extended pointer at the "PRINT FIELD:" prompt:
PRINT FIELD: ATTENDING PHYSICIAN:PHONE NUMBER
You can use simple extended pointers in many places in VA FileMan, including:
The syntax for simple extended pointers is described below.
With simple extended pointers, there must be an existing relationship based on a pointer field from the current file to the file you are interested in. In this case, you can reference a field in a pointed-to entry by using the syntax:
pfield:element
"Pfield" is the name (or number, preceded by #) of a pointer field in the current file, and "element" is an element that exists in the field to which pfield points. This is called the short form of extended pointer syntax.
For example, since ATTENDING PHYSICIAN is a pointer field in the current file to the DOCTOR file, the short form of extended pointer syntax to reference the PHONE NUMBER field in the DOCTOR file would be:
ATTENDING PHYSICIAN:PHONE NUMBER
The most complete or general form of extended pointer syntax (also called long form) is shown below:
expr:file:element (or) expr IN file FILE:element
"Expr" is any expression that applies to the file that is your current context. "File" is the name of any file. "Element" is any element (field) in the file named by "file."
For example, since ATTENDING PHYSICIAN is a pointer field in the current file to the DOCTOR file, the long form of extended pointer syntax to reference the PHONE NUMBER field in the DOCTOR file would be:
ATTENDING PHYSICIAN:DOCTOR:PHONE NUMBER (or) ATTENDING PHYSICIAN IN file DOCTOR:PHONE NUMBER
Relational Query Example
You can use simple extended pointers to make relational queries. For example, suppose you want to print all patients who are older than their attending physicians. A field in the PATIENT file called ATTENDING PHYSICIAN points to the DOCTOR file. Given a field PT AGE in the PATIENT file and a field DR AGE in the DOCTOR file, you can use the Print File Entries option and then enter the information that follows:
OUTPUT FROM WHAT FILE: PATIENT SORT BY: NAME// PT AGE>(ATTENDING PHYSICIAN:DR AGE) WITHIN PT AGE>(ATTENDING PHYSICIAN:DR AGE), SORT BY: FIRST PRINT FIELD: NAME
Here, the simple extended pointer (ATTENDING PHYSICIAN:DR AGE) is used to make a comparison between values in fields in two different files.
COMPUTED Field Example
Suppose the PATIENT file has an ATTENDING PHYSICIAN field that points to the DOCTOR file. The DOCTOR file, in turn, has a field called SPECIALTY. If you want to create a COMPUTED field within the PATIENT file data dictionary that is equivalent to the SPECIALTY field in the DOCTOR file, you can define a COMPUTED field as:
'COMPUTED-FIELD' EXPRESSION: ATTENDING PHYSICIAN:SPECIALTY
The file does not have to be specified in this case since there is a direct link between the two files through the pointer field. This is an example of the short form of the simple extended pointer syntax.
An equivalent computed expression, which explicitly identifies the file is: ATTENDING PHYSICIAN IN DOCTOR FILE:SPECIALTY. This is the long form of the syntax. It is "long" because the file name is included.
If the pointing field is a variable pointer, the long form of the extended pointer syntax must be used so that VA FileMan will know which of the pointed-to files to search. Here is the syntax:
vpfield IN file FILE:element (OR) vpfield:file:element
"Vpfield" is the variable-pointer field in the current file, "file" is one of the possible pointed-to files, and "element" applies to that pointed-to file.
The following is an example from the PATIENT file where the PROVIDER field is a variable pointer to either the PHYSICIAN file or the PERSON file, and PHONE is a field in the PERSON file. You could enter the following print specifications:
FIRST PRINT FIELD: NAME THEN PRINT FIELD: PROVIDER THEN PRINT FIELD: FILE(PROVIDER) THEN PRINT FIELD: PROVIDER:PERSON:PHONE THEN PRINT FIELD:
You would receive the following output:
NAME PROVIDER FILE(PROVIDER) PROVIDER:PERSON:PHONE --------------------------------------------------------------------------- BROWN,JOHN L. CRUSHER,BEVERLY PHYSICIAN GREEN,RICHARD MCCOY,LEONARD M. PERSON 223-3332
The long form simple pointer asked for the PHONE field from the PERSON file. Only the variable pointer from the GREEN,RICHARD entry pointed to the PERSON file. Thus, only his phone number is displayed.
Reviewed/Updated: March 4, 2007