We want to eliminate the possibility of entering duplicate customer numbers into our file. Let’s define an "input processing" table to help the user avoid duplicates and also to ensure that the correct state abbreviation is chosen for the customer’s address.
filePro Plus’s input processing is event driven. An event is an action that the user takes, such as, entering or leaving a field. When this takes place, filePro Plus can be instructed to take a particular action.
When the user presses <ESC> to save a record, the processing table starting at element 1 is always executed until the “END” command is encountered or no other elements are used.
Some events that will trigger input processing are:
Ø when the user enters a field - @WEF label
Ø when the user leaves a field - @WLF label
Ø when the user presses a key before going into update mode - @KEYx.
These events will only trigger processing if the appropriate label is found.
Now, let's define our Input-Processing table.
1. From the “Define Processing” menu, select option “2" Input Processing”. You should now see a blank processing table showing the first six elements.
2. When we are finished, the second and eighth elements of our processing table will contain examples of the “LOOKUP” command, which is a “connection” made to another file to bring in data from the file or “post” data to the file. filePro Plus can help you define a lookup. (Whenever you need help in defining a lookup, press <F5>.)
3. In the label area of element 1, type "@wlf1".
4. This label tells filePro Plus to execute this section of processing: When Leaving Field 1. Press <RETURN> twice, then press <F5>.
filePro Plus asks: “Lookup From File:” We will use “cust”. We are writing a processing table for the “cast” file, so this lookup will be used to access other records in our own file. Type “cust” and press <RETURN>. If you were not sure of the filename, you could have pressed <F6> to see a file selection window and selected the file.
5. Next, you are asked: “Name of Lookup Is:” Press <RETURN>. We don’t want to give the lookup a name now. filePro Plus then asks: “How Is The Record To Be Found?:” Respond with “K” (key field).
6. Next you are asked: “What Index Is To Be Used:” enter “b” (the index we built on the “customer number” field).
7. filePro Plus then wants to know. “What Field in ‘CUST’ Contains the Key?:” Enter "1" and press <RETURN>.
NOTE: If you are using a multi-user version of filePro, you are prompted - "Protect Record from Lookup File?". Respond to this prompt, by pressing “N”.
8. filePro Plus then asks: “If Key Doesn’t Match Exactly:” We’ll use “x” (exact).
9. The next question is: “If Lookup Fails:” Enter “n” (do nothing).
10. The final question is: “Create Browse Lookup?” The answer is “N”. We will answer “Yes” in the next lookup we define in this example. Now you should see the following in element 1:

Figure 8-1
11. Press <F3> to insert an element. Position the cursor to the “Then” line and type "end". Now you should have elements 1 and 2 as depicted in the following screen.

12. Complete the processing table, lines 3 through 7, exactly as shown in figures 8-3 and 8-3a. We will give you a line by line explanation of the processing table after you have typed it in.
Elements 1 - 6 of the processing table should look like figures 8-3 and 8-3a.

Figure 8-3

Figure 8-3a
13. Now we are about to define another lookup. This lookup not only joins two files, but also pops up a “browse window” to show the user the records in the lookup file. From this window, the user can select the appropriate record. To define this lookup, proceed as follows: Position the cursor anywhere in element 8 and press <F5>.
14. filePro Plus prompts: Lookup From File: Type: "states" and press <RETURN>. The “states” file contains the postal abbreviation, full name, and state capital of all the states of the union. It is pre-defined for you in filePro Plus software package.
15. filePro Plus prompts: Name of Lookup Is: Press <RETURN>.
16. filePro Plus prompts: How Is The Record To Be Found? Type: K (for key field).
17. filePro Plus prompts: What Index Is To Be Used? Type: a (the index was built on the “state abbreviation” field).
18. filePro Plus prompts: What Field in ‘cust’ Contains The Key? Type: 6 and press <RETURN>.
19. filePro Plus prompts: If Key Doesn’t Match Exactly: Type: g (for greater than).
20. filePro Plus prompts: If Lookup Fails: Type n (which means do nothing).
21. filePro Plus prompts: Create Browse Lookup (N): Type: y
22. Under “Browse Header” filePro Plus provides and area for you to enter the headings. Type the names of the first 2 fields listed below, separated by two spaces:
"Abbreviation" and "State Name". Press <RETURN>.
23. Under “Browse Format”, filePro Plus provides an area to identify the field numbers. The asterisk for field 1 should be aligned under the “A” in “Abbreviation.” The asterisk for field 2 should be aligned under the “S” for “State Name" as depicted in figure 8-4. Enter the field numbers and press <RETURN>.

Figure 8-4.
24. filePro Plus prompts: Browse Window: Lines: 12 Press <RETURN> to accept the default (12 lines).
25. filePro Plus prompts: Row: Press <RETURN>.
26. filePro Plus prompts: Col: Press <RETURN>.
27. filePro Plus prompts: Pop-Up Screen: Name: 0 (enter zero). Press <RETURN>.
28. filePro Plus prompts: Row: Press <RETURN>.
29. filePro Plus prompts: Col: Press <RETURN>.
30. filePro Plus prompts: Only Show Records That Match Key?. Press <RETURN> to accept “N” for “No”.
31. filePro Plus prompts: Browse Window Show option: Press <RETURN>.
32. filePro Plus prompts: Exit Keys: Press <RETURN>.
33. filePro Plus prompts: Order of Records (Ascending, Descending): Press <RETURN> to accept the default (“A” for Ascending).
34. filePro Plus prompts: Position of First Record (Top,Middle,Bottom): Type: T (for top position).
35. filePro Plus prompts: Processing Label:. Press <RETURN> for none.
36. filePro Plus prompts: Are these entries correct? If you wish to review or change your entries, press <N>. You are then re-turned to the Browse Header field. If you have entered everything correctly, press <RETURN> to automatically create the browse lookup in element 8. You should now be back at element 8.
NOTE: If you want to see a list of fields that are available from any file, do the following: Press <F6>. This displays the fields for the current file (“cast”). Now press <F6> again, and select the file name “states” and press <RETURN>. Press <RETURN> again to continue with defining the processing table.
Element 8 of the processing table should be as depicted in figure 8-5.

Figure 8-5
37. As you can see, the lookup has been extended beyond the edge of the screen. To view the rest of the line in element 8, place the cursor on the “action” line and use your right and left arrow keys.
Let's Review
The following is an "element-by-element" explanation of the processing you have entered.
Element 1
Remember, that the event that starts the processing at element 1 is the user pressing <ESC> to save the record. Our processing table has no work to do at that time. Therefore, element 1 contains the “END” command.
@WLF1
Elements 2 - 6 The label, “@WLF1”, stands for When Leaving Field 1. This tells filePro Plus to perform this section of processing when the user completes the data-entry for field 1. The purpose of this section is to insure that the customer number the user has entered is unique.
Element 2
This when-processing occurs when leaving field 1 (“@WLF1”). What happens at this time is that a “lookup” is performed. A lookup is a “bridge” or “connection” to another file for purposes of copying data from or “posting” data to the file. The purpose of the lookup is to see if the number entered by the user in the “customer number” field already exists in another record in the “cust” file.
The lookup statement means: do a lookup to the “cust” file (even though the user is already in the “cust” file). The key field is field 1, “customer number” (“k = 1”). The index to use in the “cust” file is “B” (“i = b”), which was built on the “customer number” field. “-n" means that filePro Plus will do nothing if the lookup fails. “x” means that the contents of the field in the current record and the contents of the field in the lookup file must match exactly or the lookup fails.
Element 3
If the lookup fails, meaning there is no match found in the key fields, then END this "when processing" here: there is no need for it since the user has entered a unique customer number.
Element 4
If filePro Plus arrives at this line it means that the lookup in element 2 was successful, that is, a customer with the same customer number was found. We must test to see if the record we found is the same as the record we are on. To do this we will test if the contents of the system-maintained field, “@RN” (record number) in the lookup file is the same as the contents of the record number field for the current record. If they are the same, END the when processing here; the user is updating an existing record, not entering a new one.
Element 5
If a statement in the condition element is not true, the instructions in the action line will be ignored and processing will “fall through” to the next element. If the condition statements in elements 3 and 4 are false, the processing will arrive at element 5. If the processing arrives at element 5, the customer number the user entered is not unique. The instructions on the action line cause the computer to BEEP once and display the message “Customer Number Already On File". The “< 1<” in the middle of the message will actually be the contents of field 1 in the current record.
The “<“ used above, is a “text manipulation operator” which “pushes” a field to the left and joins it with the field on the left, leaving or inserting one blank space. There are two other text manipulation operators. “&“ joins two fields exactly as they are and “{“ joins two fields stripping out all blank spaces between them.
Element 6
The cursor is then returned to field 1 of the current screen for the user to enter a new customer number. The “SCREEN” command ends the When Leaving Field processing.
@WLF6
Elements 7 - 10 This when-processing occurs when the user is leaving field 6 (“state”).
Element 7
If field 6 has something in it (it does not contain all blanks), the processing ENDs. The “state” edit type will make sure that a valid state abbreviation is in the field. If field 6 is empty when the user tries to leave, processing goes to the next element.
Element 8
A browse lookup to the “states” file is performed. As you may recall, the “states” file contains all the state abbreviations, state names, and capital cities. The file is included in the filePro Plus software package.
The key field in the current record to use is field 6 (“state”). The index in the lookup file to use is “A” (“i = a”), which is built on the “state abbreviation” field. The browse window will have 12 lines or records in it. (brw = 12). If you press “V” to view a record when the window is displayed, screen 0 from the states file (pop = 0) appears. The window displayed records in ascending order and the top entry will be high-lighted (fill = asc,top). The rest of the lookup line is the heading and fields displayed in the window. The only two conditions that could cause this lookup to fail are:
(1) if the “states” file were empty (contains no records);
(2) if the user does not select any state by pressing <CTRL><BREAK> or <CTRL> <C>.
The purpose of this lookup is to display, in a “browse lookup window”, the records from the “states” file to help the user find the right state abbreviation to enter in the current record.
Element 9
If this lookup fails, (the user has not chosen any state) the computer BEEPs once, the cursor goes back to field 6 of the current screen, and the when-processing ends. If the lookup is successful, processing goes to the next element.
Element 10
With the browse lookup window displaying the “states” records, the user may select a record by moving a highlight, and pressing <RETURN>. Once the record is selected, field 6 (“state”) in the current record is assigned the value in field 1 (“state abbreviation”) of the selection record in the lookup file, “states”. The display statement redraws the screen. You must always have a DISPLAY or SCREEN command at the end of “when-leaving” or “when-entering” field processing.
Make any corrections that may be displayed. At the “Hardcopy? (Y/S/N)” prompt, press <RETURN>.
At the “Cross Reference Hardcopy” prompt, press <RETURN>. From the Define Processing menu, press <X> to return to the main menu.
40. At the “Check Syntax” prompt, press <Y>.
41. At the "Cross Reference Hardcopy" prompt, press <RETURN>.
42. From the Define Processing menu, press <X> to return to the main menu.