• CSPro Getting Started Guide
    • Introduction
    • Installation
    • CSPro Tutorial
      • About the Tutorial
      • Exercise 1: Create a Data Entry Application
      • Exercise 2: Create the Data Dictionary
      • Exercise 3: Create the Data Entry Forms
      • Exercise 4: Enter Data
      • Exercise 5: Tabulate Data
      • Exercise 6: Modify the Table
      • Exercise 7: Add Edits to the Data Entry Application
        • Step 1: Write Logic for the Edit
        • Step 2: Compile the Logic
        • Step 3: Test the Edit
        • Step 4: Complete the Case
      • Exercise 8: Run a Batch Application

Step 1: Write Logic for the Edit

(Exercise 7, Add Edits to the Data Entry Application)
We will now return to the data entry application. We will introduce a check to make sure that married people are at least 12-years-old. In our data entry application, we will perform this check immediately after the keyer enters the marital status.
If you still have your cross tabulation application open from previous exercises, close it now. Select File -> Close from the main menu. CSPro may prompt you to save changes. Select Yes.
  1. Open the data entry application we created earlier. Click on on the toolbar, or select File -> Open from the main menu. Click on the application name, MyEntry.ent, and click Open.
  2. Get ready to write logic by clicking on the toolbar, or pressing Ctrl+L or selecting View -> Logic from the main menu.
  3. Press Ctrl+T to show names instead of labels in the forms tree.
  4. Click on the + next to PERSON_RECORD_FORM then click on the + next to PERSON_RECORD000 then click on MARITAL_STATUS. The frame on the right hand side of the screen should show PROC MARITAL_STATUS at the top.
  5. Note that PROC is short for procedure. We put our logic in the procedure for MARITAL_STATUS because we want it to execute immediately after the operator keys this field.
  6. Type in the logic code exactly as you see below.
PROC MARITAL_STATUS

   
if MARITAL_STATUS = 1 and AGE < 12 then
       
errmsg("Too young to be married");
   
endif;
Continue to the next step: Step 2: Compile the Logic.