Epi Info™ User Guide
Check Code
Check Code: Customizing the Data Entry Process
Check Code Commands
Create a Skip Pattern Using IF/THEN and GOTO
Use IF/THEN statements to create skip patterns based on the answers to questions in the form. This example creates code, which states that if the person answered No (-) for the Hospitalized field, then the cursor subsequently jumps to the field Was the patient treated with antibiotics? and skips the Hospital Admission date field.
- From Form Designer, Open the Ecoli.prj project.
- Double click on the FoodHistory_NoCheckCode form.
- Click Check Code or select Tools > Check Code Editor. The Check Code Editor opens.
- From the Choose Field Block for Action section, expand the node for Page 1 to see the various fields on the first page.
- Expand the node for the Hospitalized field.
- The action needs to occur after data are entered into the Hospitalized field.
- Double click on the after event.
- A block of code for the Hospitalized field is created and displayed in the Check Code Editor.
Figure 3.11: Dialog Block for Action after Hospitalized
- The code appears in the Check Code Editor.
Figure 3.12: If/Then Block Code After Hospitalized
- Click If from the Add Command to Field Block list box. The IF dialog box opens.
- From the Available Variables drop-down list, select the field to contain the action. For this example, select Hospitalized. The selected variable appears in the If Condition field.
- From the Operators, click =.
- From the Operators, click No. The If Condition field will read Hospitalized=(-).
- Click the Code Snippet button in the Then section. A list of available commands appears.
- From the command list, select GoTo. The GOTO dialog box opens.
- Select the field for the cursor to jump to based on a No answer from the list of variables. For this example, select Antibiotics.
- In the GOTO dialog box, click OK to return to the IF dialog box.
Figure 3.13: If/Then dialog box
- Click OK. The code appears in the Check Code Editor. The example code appears as:
Figure 3.14: If/Then Check Code Command
- Click the Verify Check Code button from the Check Code Editor.
- Click the Save button from the Check Code Editor.