Instructions

<= previous ^ top next =>

There are two steps to using ecpSE. The first step is to define what database, table, and fields data will be entered into. This is done using ecpSE.py. ecpSE.py is more or less a wizard type program that generates a program called ecpSEa.py and several support files.

For the second step ecpSEa.py is used to take data from a scanner and put it into the database fields already defined. While using ecpSEa.py one can control exactly how the data is dealt with, changed, and edited on its way to the database.


Generating an ecpSEa Program

This is the first step to using ecpSE.

Running an ecpSEa Program

Once your ecpSEa file has been generated you can either scan or import a text file into a database. These are the general instructons. There is an example with more detailed instructions below.

Flow Chart


#
#              -------------
#                  START       
#              -------------
#                    |
#                    |
#                    V
#              -------------
#  --------->    SCAN/OPEN   <---------------------------------------------
#  |           -------------                                               |
#  |                 |                                                     |
#  |                 |                                                     |
#  |                 V                                                     |
#  |           -------------              -------------                    |
#  |           IS THERE DATA? ---(no)-->  ENDSCAN/CLOSE                    |
#  |           -------------              -------------                    |
#  |                 |                                                     |
#  |               (yes)                                                   |
#  |                 V                                                     |
#  |           -------------                                               |
#  |               PARSE                                                   |
#  |           -------------                                              (no)
#  |                 |                                                     |
#  |                 |                                                     |
#  |                 V                                                     |
#  |           -------------              -------------             -------------
#  |           CHECK FOR ERR? ---(yes)-->  ERR EXISTS?  ---(yes)-->   FIX ERROR?
#  |           -------------              -------------             -------------
#  |                 |                          |                          |
#  |                (no)                       (no)                      (yes)
#  |                 V                          |                          |
#  |           -------------                    V                          V
#  ----------    ENTER DATA  <---------------------------------------------
#              -------------
#
Fig. 3.3

Editing Data Parsing Parameters

The Data Parsing Parameters can be viewed and edited in the Parsing Window. They are saved (and can also be viewed) in Paramlist.txt. Each line of text consists of 5 items separated by commas. For example:
Field_0, 40, 4, Len, == 4
All five items relate to one database field. Thus there is one line of parameters for each field in the database that will recieve data. If you want to make multiple checks on some data you will ned to preface the field name with a ., !, or ]. See below for details. These parameters determine how the data from the scanner will be parsed, and what sort of error checking will be done.
The first item is the name and index of the database field. This is generated by ecpSE and should not need editing (and should not be changed. If you need to add new fields, add them, end the program, and then restart it.). The field name is relatively unimportant, and is there for user benefit. If the index is changed (either the underscore or the index number), the program will not work.
The second item determines where the data string will be sliced. Note that because Python strings are based upon C arrays of characters, Python consideres the first character of a string to be in position 0. Thus to begin a parse at the 41st character one would put '40' as the second parameter.
The third item determines the length of the parse. In the example above the cut would be 4 characters long.
The last two parameters determine how the slice of data should be analysed. The 4th parameter determines the method of analysis while the 5th supplies arguments as to how the analysis is done. Each possibility for the fourth parameter (and the arguments it will support) is dealt with below. [These are not case sensitive, so conv = CONV = Conv] [The next two parsing types should be used mainly with secondary and error catching parameters (explained below)]

Secondary and Error Catching Parameters

Using these types of data handlers one can check fields multiple times and correct errors that occur. There ar three types of specifiers. These are ".", "!", and "]"
  • . is used to visit a specified field a second time. It is run when there are no errors from previous parameters.
  • ! is used to automatically handle previous errors. It is run only when there are errors from previous parameters. It will undo errors.
  • ] is run regardless of errors. If there was an error previously it will still register as such [! can undo errors] but the second editor will run.
To use these one uses the same error handlers described above, but does not specify data parses. The data that is checked or edited is the already checked data. Thus parameter entried look like the following [With 3 parameters instead of 5]:
  • .LastName_2, COMB, FRONTSP->FirstName_0
    This would append (the already edited) "FirstName" field to the front of the LastName field assuming there were no errors in the LastName field the first time through.
  • !LastName_2, REPLACE, Data This would replace whatever data in the LastName field caused an error the first time through with the string "data".
  • ]LastName_2, CASE, CAP This would capitalize the first letter of words in the LastName field regardless of errors that occured. If there was an error it will still pause.

Error Checking

Disabling Fields

There are times that you may want to disable a fields entry into a database. Either because you are parsing data from different parts of a string then combining them into one field [COMB], or an error has occured and you want to disable a field for a single form. To do the former, simply uncheck the box next to the field's data editor and leave the Reset Checks check unchecked.
If you need an extra field to edit data in you can add a dummy parameter. Make sure that the field name and number are both unique like Dummy Field_16, 40, 10, LEN, !=10. Save your changes, close ecpSEa and restart it. The new field will appear.
If you need to disable a field for one form because there is an error in the data, uncheck the box next to the field's data editor, and check the Reset Checks check.

Example

This example will go through the process of scanning two forms, one with errors, and one without.
First, notice the parsing parameters in Figure 3.4. For a line-by-line explanation see below.


Fig 3.4

There are examples of most types of parameters. The names of the database fields correspond to their data types.
When the scan button is pressed the first string of data is collected (in this case from a .dat file).
||||||||||||||||||||||||||||||||||||||||XXXXXXXXXXABCDE800751103311974112102
NCS reserves the first 40 characters (blue) for their use. The next ones (green) will be parsed according to the parameters above. After parsing the form looks like Figure 3.5 with no errors.


Fig 3.5

Pressing Accept Form will enter the data into the database and scan the next form. Normally with error free data you will not have to accept it. In this case the program is running in manual error checking mode.
The next string of data is ...
||||||||||||||||||||||||||||||||||||||||XXXXXXXXXXABCD*110750013311974043102
After parsing the program finds errors. It shows where these errors are like in the Figure 3.6.


Fig 3.6

The details of the errors are also displayed in the bottom of the window. The errors can be corrected and the data entered, or the Reject Form button can be pressed to discard the data. If bad data is not corrected and the database rejectes the INSERT, the user will be returned to the edit position. (Even in non-error check mode a database error will result in the chance to edit the data.)

Line-By-Line Explanation of Example

<= previous ^ top next =>