Epi Info™ User Guide

Check Code: Customizing the Data Entry Process


Check Code Commands

 

Introduction to Check Code Commands

Check commands are structured in blocks.
Each block begins with a field, page or form name and ends with the word END.
All commands must be within a field-name block.
Commands in a block are usually activated either before or after an entry is made in the field.
For some field types, blocks can also be activated when clicking on the control (i.e. checkboxes and command buttons).
The usual case is that the commands are performed after an entry has been made and the user has pressed the < ENTER > key or when the cursor has left the field automatically.
This behavior can be altered by placing commands in blocks called BEFORE.

The format of check code blocks is usually structured as follows:

Field VARIABLENAME
After
Check Code syntax inserted here
End-After
End-Field

  • The FIELD parameter establishes to which field name the check code block corresponds.
  • The AFTER parameter specifies when the action will occur. The AFTER event is executed as soon as the cursor leaves that field.
  • The END-AFTER parameter specifies the closing of the commands to be executed, in this example, for the AFTER event. In other words, any check code inserted between the AFTER and END-AFTER section will be executed for that field after the cursor leaves the field.
  • The END-FIELD parameter simply closes the block of commands incorporated for the corresponding field.

In the example below, we have incorporated an AFTER event for a field called DOB. The block of check code will execute the assignment of a value to the field AGE using the YEARS function. The YEARS function will calculate the difference between two date fields and provide the result in Years.

Field DOB
After
ASSIGN
AGE =YEARS( DOB, SYSTEMDATE)
End-After
End-Field

Top