|Contents:||Main||Chapter||See Also:||Getting Started Manual||Programmer Manual|
You can establish an extended pointer link even if there is no pre-existing pointer relationship between the two files. You use a value from one file to do a lookup in a second file.
Suppose you store in the PAY FACTOR file a list of factors for calculating taxes. Each entry in this file corresponds to a different pay scale. In the PERSONNEL file, you have a field called PAYSCALE. You want to retrieve the value of a field DEDUCTION in the PAY FACTOR entry that equals the PAYSCALE field for each entry in the PERSONNEL file. You can create a COMPUTED field expression in the PERSONNEL file:
'COMPUTED-FIELD' EXPRESSION: PAYSCALE IN PAY FACTOR FILE:DEDUCTION
NOTE: PAYSCALE was not defined as pointing to the PAY FACTOR file. The link to that file is made by the COMPUTED field definition. PAYSCALE could itself be a COMPUTED field. In this situation, the value of the PAYSCALE field in the PERSONNEL file is used to do a normal lookup in the PAY FACTOR file using all lookup type cross-references.
In database terminology, this extended pointer capability is similar to a JOIN operation because you can specify at any time a new relationship between two formerly unrelated files. Therefore, we call this type of pointing the Join Extended Pointer.
If the join expression matches more than one entry in the file being joined, the first matching entry (by internal entry number) is returned as the result of the join. Thus, if your join expression is likely to match more than one entry, be aware that only the first matching entry is returned.
You could find out if any entries in the PERSONNEL file could be matched against the NAME field in the PATIENT file just by specifying the following sort:
OUTPUT FROM WHAT FILE: PATIENT SORT BY: NAME IN PERSONNEL FILE
The expression at the "SORT BY:" prompt selects entries in the PERSONNEL file where the value of the NAME field in the PATIENT file matches the PERSONNEL file's .01 field. The PATIENT file's NAME field is being used as a lookup in the PERSONNEL file. Since we are evaluating the .01 field of the PERSONNEL file, the ":element" part of the extended pointer syntax is unnecessary.
Reviewed/Updated: March 4, 2007