For your next hands-on exercise, you will add error checking to your mydatent
Write two public user-defined functions that use the pattern match operator to validate the Name and Phone, and write an error message for invalid data. Up to now you've been entering names as First Last
, but your code should now validate names as Last,First
Add a default area code to the Phone prompt, and a line to add this default to phone numbers without area codes.
Write a public user-defined function that uses $ZDateH
to validate the Date of Birth, and convert it to internal format. The function should write an error message for invalid dates. Make sure it's a date in the past (before today).
Call the new user-defined functions from your prompts.
to display the date, no matter how the user actually entered it, in one of the standard formats.
Save and run your routine, and test all three prompts with bad and good input.
For instructions, click below.
© 1997-2019 InterSystems Corporation, Cambridge, MA