Check Code
Stimulus/Response Sequence
Opening an Existing Project | ||
---|---|---|
1 | Stimulus: Response: | User clicks the "Create Forms" button from the Epi Info™ 7 main menu or executes the MakeView.exe program from the Epi Info 7 folder. Form Designer window opens. |
2 | Stimulus: . Response: | User clicks "Open Project" from button bar or selects File→Open Project from menu bar or types Ctrl-O or selects File→Recent Projects and selects an existing project from the list. A file browser opens on the <InstallationDirectory>\Projects\ directory, showing directories for existing projects. |
3 | Stimulus: Response: | From the file browser, user opens a Project directory, then selects and opens the <ProjectName>.prj file. File browser closes and Form Designer window opens, consisting of a menu bar and button bar along the top with the remainder of the window divided into a Project Explorer frame and a drawing canvas populated with the fields of the project's form. |
4 | Stimulus: . Response: | From the Form Designer window, the user clicks on the Check Code button on the button bar or selects Tools→Check Code from the menu bar or right-clicks a field on the canvas and selects Field Check Code from the context menu. A window opens containing the Check Code Editor. |
Objective
Given a questionnaire containing all field types, create an example of every applicable Check Code command, function, and operator using the data entry control points available in the form.
Preconditions
The Check Code Editor is open on a form.
Postconditions
Check Code will be added to the form, demonstrating their function including the arguments that govern their functionality and the fields and variables with which they interact.
Functional Requirements
Using the Check Code Editor, the system shall enable the user to complete the following operations on the form currently open in Form Designer:
- view a list of Check Code Action Control Points (listed below)
- view a list of Check Code Action Commands (listed below)
- associate specific commands with specific Fields
- program commands to execute at specific Action Control Points
- define variables with specific scope and type
- validate the Check Code commands associated with all Fields and variables in the form
- Save the Check Code with the corresponding form
Action Control Points
Level | User Stories | Notes |
---|---|---|
Form | The user shall have the ability to program Actions to occur:
| |
SubRoutine | The user shall have the ability to program Actions to occur when invoked by the "Call" command. | Creates a subroutine code block with the user-supplied name. |
Record | The user shall have the ability to program Actions to occur:
| |
Page | The user shall have the ability to program Actions to occur:
| Relevant to multi-page forms |
Field | The user shall have the ability to program Actions to occur:
| Most check code commands are used at the field level. The field type governs which of the three Action Control Points are available. |
Action Commands
The table below lists the Check Code commands along with stories describing their actions. The command actions are defined by using the Check Code Editor. Once defined, the actions are expressed when the user interacts with the form during data entry using the Enter module.
Command | User Stories |
---|---|
Assign | Command shall assign a value or expression result to its argument (variable). |
AutoSearch |
|
Call | Command shall execute a subroutine by name. |
Clear | Command shall set the variable to NULL/Missing or in the case of a check box field type, the field is set to false (unchecked). |
Define |
|
Dialog |
|
Disable |
|
Enable |
|
Execute |
|
Geocode | Command shall determine geo-spatial coordinates (latitude and longitude) given an address, postal code, or registered place. |
GOTO | Command shall move the cursor to the indicated field, regardless of tab order, or other mouse events provided that the indicated field is a field that can receive data (not a label field or disabled). |
Help |
|
Hide | Command shall render the field and caption or prompt of the indicated field invisible. |
Unhide | Command shall render the field and caption of the previously-hidden field visible again. |
Highlight | Command shall highlight the field and caption of the specified field with a yellow background. |
Unhighlight | Command shall remove highlighting on the field and caption of the specified, previously-highlighted, field. |
If | Command shall create a logical construct to conditionally execute one of potentially two blocks of code based on the evaluation of a Boolean expression. Command(s) in the Then block are executed if the expression returns "TRUE" (1); command(s) in the optional Else block are executed if the expression returns "FALSE" (0). |
NewRecord | Command shall save data from the current record, close it, then open a new record. If there are unsaved edits to the record, a confirmation dialog is raised, asking whether the record should be saved. |
Quit |
|
Set-Required |
|
Set-Not-Required | Command shall set a field to be optional ("not required"). |
GoToForm | Command shall open the named form, assuming form is related to the current form. |
Variable Types and Scope
Pragma | Description | Mnemonic |
---|---|---|
Variable Scope | ||
STANDARD | Values persist as long as a record is current and are reset when a new record is loaded. | Record |
GLOBAL | Values are robust to changing records and forms but are reset when the program is closed and restarted. | Program |
PERMANENT | Values are stored between invocations of Epi Info™ 7 and are shared between modules. | Persistent |
Variable Type | ||
TEXTINPUT | Variables of this data type can receive any alpha-numeric characters including symbols and the output of functions. | Text |
NUMERIC | Variables of this data type can receive numbers, including the output of functions that return numbers. | Number |
DATEFORMAT | Variables of this data type can receive date values, including the output of functions that return dates. | Date |
YN | Variables of this data type can receive the Boolean values of (+) for Yes and (-) for No. Until an assignment is made, YN type variable values are (.) or missing. | Boolean |
User Interaction and Design
The Check Code Editor is designed to support both direct entry of Check Code (text in the Check Code "language") and assisted entry using menus and interactive dialog windows. The interface consists of a large code editor panel, a tree display corresponding to the Check Code Action Control Points, and a list of Check Code Action Commands. Selecting a terminal node from the Action Control Points tree, such as Page 1:Page→<field>→after causes the cursor to be placed at the designated code block in the editor if the block exists. If the block does not exist, selecting a terminal node from the Action Control Points tree enables a button that generates a code block for that control point. Double-clicking a terminal node from the Action Control Points tree also generates a code block for that control point if one does not exist. The user may either type the desired command(s) inside the block or choose a command from the list. Selecting a command from the list opens a command-specific interface which enables the user to select the appropriate arguments and functions to complete the desired operation. This process of selecting Control Points and choosing Action Commands may be repeated as many times as necessary to accomplish the desired Check Code tasks.
Check Code can be commented using the editor for the purpose of documentation or to disable specific commands while debugging. Two comment forms are recognized. A single line can be commented by starting it with a "//" (double slash). A block of lines can be commented using the C-like convention of placing a "/*" in the first column at the starting line for the comment block and ending the block with "*/". All lines between "/*" and "*/" are ignored.