Locate From - To (Magic xpa 4.x)
The Locate property enables you to locate a specific value according to a set expression.
You can specify two expression numbers in the Locate property, one each for lower and upper values. These values determine that the first data view instance processed will be the first record that is found between the two expression values. The expressions must evaluate to a value matching the variable's attribute.
If you need to locate the first record using a logical condition, specify this condition in the Locate Expression property in the Range Window.
Locate expressions do not affect the data view itself.
The display of records after a Locate operation in an Online task is determined by the setting of the Center Screen in Online property in the Preferences tab of the Environment dialog box. If the Center Screen in Online property is set to Yes, then the task begins with the located record presented in the middle of the Form screen, with the insertion point parked on its first parkable variable. If the Center Screen in Online property is set to No, then the task begins with the located record presented at the top of the Form screen.
Unlike Range, Locate allows the end user at runtime to refer to data view records outside the domain of Locate From/To expressions and to move the insertion point to those records.
If you specified both From/To Locate expressions and no record meets the specified criteria, the cursor moves to the first record with a higher index than the To expression value and the message "Record not found - Positioned at next" is displayed. If no record with an index higher than the upper expression value exists, the cursor moves to the first record in the data view and the message "Record not found - Positioned at beginning" is displayed.
If you specified only a To or a From Locate expression and an exactly matching record could not be found, the processing pointer moves to the first record with a higher index, but no message is displayed. If you specified only a From Locate expression and an exactly matching record could not be found, the cursor moves to the first record of the data view.
If the Locate Expression variable is not an index and a record matching the specified criteria is not found, then the cursor pointer will be positioned at the first record in the data view.
Note:
-
The asterisk (*) or question mark (?) characters used in the main source's range or locate is used as a wildcard character. It represents a string of characters. The asterisk and question mark can only be used as the last character in a string.
-
To use the asterisk or question mark as a value in the range or locate, precede the asterisk or question mark with a backslash (\). Since version: 1.9h
Examples of range and locate syntax:
-
a* will do the range or locate on a* (where * is a wildcard character)
-
a\* will do the range or locate on a* (where * is a string)
-
a\\ will be a\
-
a\\* will do the range or locate on a\* (where * is a wildcard character)
-
a\b will remain a\b