Exercise 1: First Data Entry Class
Click here to return to the exercise description in the main part of the tutorial.
-
Start VS Code, and create a new class. Use ObjectScript for the package name and DataEntry1 for the class name. You'll see this code:
Class ObjectScript.DataEntry1 { }
-
Within the {}, create the Main() method.
Class ObjectScript.DataEntry1 { /// first data entry method ClassMethod Main() { } }
-
Enter the following ObjectScript into the method:
read !, "Name: " , name if name = "" { quit } // user entered nothing read !, "Phone: ", phone read !, "DOB: ", dob // display the data write !!!, "Name:", ?20, name write !, "Phone:", ?20, phone write !, "DOB:", ?20, dob
-
Click the Save and Compile buttons.
-
Start the Terminal, and run your method, by typing do ##class(ObjectScript.DataEntry1).Main().