Another common operation is to look up an existing record stored in a data file. To find a particular record, first press the QUERY FIRST key <F2>. Form clears all the non-initialized entry fields and positions the cursor in the first field displayed on the form. You can then enter data in one or more fields that identifies the records you want to find. When you press the FIND NEXT key <F3>, form searches for the first record that matches the data you previously entered. While form searches the file, it displays SEARCHING on the status line. When form finds a matching record, it displays the record on the screen and displays FIND NEXT on the status line. If no matching record are found, form displays the message None found and you may then try to match another field or proceed with another function.
If more than one record exists that matches the search pattern, you can find the next matching record by pressing the FIND NEXT key <F3>. When you press the FIND NEXT key <F3> after the last matching record has been displayed, form displays the message No more on the status line. If the FIND NEXT key <F3> is pressed once again, the search is restarted at the beginning of the file, and the first record (found earlier) will be redisplayed.
You can enter data in several fields after pressing the QUERY FIRST key. For example, you could enter a name into the Name field and a city into the City field. When you press the FIND key <F3>, only the records that match both the Name and City fields will be found and displayed.
Records in a data file usually have a field that in some way uniquely identifies them. This field is referred to as the key field. On the form in the above screen, the field labeled Subscriber contains a code that uniquely identifies each subscriber. When you match a key field (the subscriber field, for example) with the functions QUERY and FIND, matching records are found very quickly. If neither of these types of fields are used when the QUERY and FIND functions are performed, then form must sequentially search the entire file to find the records. If you frequently do queries on non indexed fields that take a long time, you may want to consider adding a secondary index to those fields to speed queries. See Chapter 4, Creating RMSfiles for more information on indexes.
You can interrupt a FIND, if desired, by pressing the interrupt key. Doing this stops the search in progress, and the message Interrupted is displayed in the upper status line. At that point, another QUERY may be initiated, or any other available function may be selected.