Hands-On Exercise 6
In this lengthy exercise, you'll add phone number and name lookup options to ObjectScript.Lookup1. You'll allow the user to pick from the list of matches and display the data for their choice.
Write a CurrentCount() method that uses $BitCount on the BitMap-ID index to display a message showing the total number of records. The three argument form of $Order will also be useful for this. Call this new method at the top of Main()
Add code to Main() and GetInput() to handle a full phone number or just an area code (Examples: 617-621-0600 or 617-).
Write a Phone() method, that takes the phone number (or just area code) as an argument, and displays matches. Since phone numbers are unique, you'll have another opportunity to use the three argument form of $Order.
Add code to Main() and GetInput() to handle a full or partial name (Examples: Smith; Smith,John; Smith,J; Sm,John; Sm,J). So that the user is able to enter the name without caring about case, use $ZConvert to format the full or partial name to have initial capitals.
Write a Name() method, that takes the full or partial name entered by the user as an argument. Write three nested $Order loops to display all matches.
Update Help() with the additional lookup options.
Keep track of the matches you display using an array to associate the match number that the user sees with the ID number of the match. Modify all three methods (DOB(), Phone(), Name()) to use this array.
Write a Select() method to allow the user to choose a match and return its ID number. Modify DOB(), Phone(), and Name() again so that each one calls Select().
Modify the signatures of DOB(), Phone(), and Name() to return the chosen ID number as their new second argument, and modify Main() so that DOB(), Phone(), and Name() pass id by reference.
Write a TakeAction() method that takes ID number as its argument. For now, it simply retrieves the chosen record from ^PersonD, and calls Display() from ObjectScript.DataEntry4 to display the record. Modify Main() to call TakeAction().
For instructions, click below.