Link Criteria (Magic xpa 2.x)
If the link's purpose is to access an existing record rather than to create a new one, the link is considered successful if Magic xpa finds a linked record whose index segment values match the values resulting from the evaluation of the Link expressions. The Return Code value for a successful link is True (Logical). If no matching record is found, the link fails and the Return Code is set to False (Logical).
The following matching criteria can be used for links:
Single value for matching – To specify a single index value for matching, make the Locate lower expression identical to the Locate upper expression for each index segment.
Range of values for matching – When you define a range of possible matching values for one or more index segments by using two different Link expressions as Locate lower/upper expressions, Magic xpa will establish a link to the first record of the linked file for which the value of an index segment is included within the range of values specified. By using the Direction property in the Link operation you can control the order of access to the linked file, and thereby determine whether the match is with the first or the last record of the range.
Partial matching – To specify partial matching, define Locate lower/upper expressions for only those index segments you want used for matching. Magic xpa will establish a link to the first record of the linked file for which the values of those index segments specified match the range of values specified.
Extended matching – In addition to the Locate lower/upper expressions you define in Select Variable operations for the linked file, you can also:
-
Specify additional Locate lower/upper expressions for any of the link's selected variables and on any Virtual variables selected within the link. Magic xpa will establish the link only if all Locate lower/upper expressions defined inside the link are satisfied. The only difference between link expressions for index segments and link expressions for other selected variables is that Magic xpa uses a different technique to perform the match: index segments are matched using the very fast index access, and all other variables are matched using a sequential search starting at the point where index segments were matched.
-
Specify Range lower/upper expressions for any of the link's selected variables and for any Virtual variable selected within the link. In such a case, all Range lower/upper expressions are evaluated when the task is invoked (regardless of whether the Variable operations they are associated with are defined over the main file or over any of the linked files). Later, the link is established, and the selected variables of the linked record are added to the record data view. Then Magic xpa checks that the link's selected variables having Range expressions match these Range criteria. If not, the current main file record is skipped and the next is read.