Skip to main content
************* PRERELEASE CONTENT *************
Previous sectionNext section

Exercise 1: First Data Entry Class

Click here to return to the exercise description in the main part of the tutorial.

  1. Start Atelier, 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
    {
    
    }
    
    Copy code to clipboard
  2. Within the {}, create the Main() method.

    Class ObjectScript.DataEntry1
    {
    
    /// first data entry method
    ClassMethod Main()
    {
        
    }
    }
    
    Copy code to clipboard
  3. 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
    
    Copy code to clipboard
  4. Click the Save and Compile buttons.

  5. Start the Terminal, and run your method, by typing do ##class(ObjectScript.DataEntry1).Main().