Let's get started with the lookup routine. This routine will allow lookups by name, phone, or date of birth. The instructions below contain suggested names and functionality for the subroutines you need to write.
section will have a loop that calls getsubmit
, which prompts the user for a string. The user may enter ?
to get help, a full/partial name, a full/partial phone number, a date of birth, or press Enter to quit. In getsubmit
, use validDOB@myBASdatent()
to verify the date of birth. If the user enters ?
, the help
subroutine lists the lookup alternatives.
, if the user enters a valid date of birth, the getdob
subroutine checks to see if the internal form of the date of birth is in ^PersonI
, and then loops through the index to find all ids of the people with that date of birth.
, if the user enters a full or partial phone number (617, 617-621, or 617-621-0600), the getphone
subroutine finds the matches. Use the three argument form of Traverse()
. Note: you may inadvertently introduce a bug when writing getphone
. The solution is in the step-by-step guide.
, if the user enters a full or partial name (Smith,John; Smith, J; Sm, John; Sm, J), the getname
subroutine finds the matches. Use formatName@myBASdatent()
to format the name before searching.
For any list of matches, each person is displayed using the display
subroutine, which should accept the id as a parameter, and print all the data for the person. display
also takes an additional argument, either line
. Use line
for displaying matches in a list horizontally, and table
for displaying the user's single choice vertically, using display@myBASdatent()
Keep track of the matches you display using a local array to associate the match number that the user sees with the id number of the match. Write a pick
subroutine to allow the user to choose a match.
For instructions, click below.
© 1997-2019 InterSystems Corporation, Cambridge, MA