From the "You don't sell the steak, you sell the sizzle" department comes the Browse Lookup Auto Complete routine.
It's nothing earth shattering, but it may help you sell a system or an upgrade.
Do you ever wish that filepro had a nice AutoComplete feature (like IE5) when entering data that is to be verified by a browse lookup?
Well, neither do I.
BUT we all know customers that would love a sexy new routine (being the techno-junk turkeys that they are.)
And:
- It's easy
- It's fun
- It's educational
- It's free
It does not require any additional variables or real fields so it is transparent to your existing programming.
Here is how it works:
When the user enters the field that you choose, a browse lookup appears, with the data that was already in the field highlighted. The user is given a data input area. As the user types, the browse lookup and the data being typed are automatically completed using the nearest matching looked-up value.
In the sample code below we are looking up to a Zip Code file named "brwzip" to validate the city that the user is typing into field 1. The action starts when the user enters field 1, the city name field.
To implement this routine in your code:
Use a @WEFxx label (where xx is the field number or dummy variable) and use the following code:
@wef1 If:
Then: call "brw"; display; skip
Here is the code for the brw routine:
Dec 4, 1999 14:04 File Name: BRW Page 1
Processing: BRW
If: 'Browse Lookup Auto Complete routine
1 Then: 'By Howard Wolowitz howiewz@earthlink.net (203) 270-7052
If:
2 Then: 'Assumes that field 1 is a city name field.
If:
3 Then: 'Uses filepro file: "brwzip" to verify the users input
If:
4 Then: '*****************************************************************
If: '***CHANGE FIELD NUMBER 'position to old city (if any)
5 Then: ky=1{""
If: '*****************************************************************
6 Then:
loop If: 'force browse to fall through
7 Then: pushkey "[entr]"
dobrw If:
8 Then: lookup zip = brwzip k=ky i=b -ex b="(brw=12,2,-1 show=pkeep fill=asc)
[City ST Zip]*2 *3 *1 "
huh If: not zip 'no match or user break key
9 Then: goto skip
If: zip(2) ne ky 'if no match make ky = last matched characters
10 Then: w=zip(2); ky=mid(w,"1",len(ky))
If: zip(2)=ky or ky="" 'show selected city
11 Then: show ("20","30") "Enter City - "&zip(2)
skip If: 'but leave cursor after last typed good character
12 Then: show ("20","30") "Enter City - "&ky
If: 'we handle break
13 Then: break off
If: 'wait for key and save any @sk into sk (to allow debugger)
14 Then: a=waitkey; sk=@sk
If: 'restore break to filepro
15 Then: break on
If:
16 Then: '*****************************************************************
If: sk="entr" '***CHANGE FIELD NUMBER 'one selected (pressed enter)
17 Then: 1=zip(2)
If: '*****************************************************************
18 Then:
If: sk="brky" or sk="entr" 'user canceled or finished
19 Then: clearb; cls("20","1"); END
If: "|bs|clft|bksp|" co "|"&sk{"|" and len(ky) gt "0" 'handle backup
20 Then: w=ky; ky=mid(w,"1",len(ky)-"1"); goto loop
If: "|crup|cdwn|utab|dtab|" co "|"&sk&"|" 'allow some navigation keys
21 Then: pushkey "["&sk&"]"; goto dobrw
If: sk="home" 'handle home key
22 Then: ky=""; goto huh
If: len(a)="" 'no character - must be NG @sk - ignore
23 Then: goto huh
If: 'build potential new key to test
24 Then: w=ky&a
If: 'does new key match a record?
25 Then: lookup zip = brwzip k=w i=b -nx
If: zip 'yes, use it
26 Then: ky=w
If: 'reshow browse and get next character
27 Then: goto loop
Make the changes to the above two tables to reflect your field number or letters and save and tokenize the "input" and "brw" processing tables, and that's it.
Since this is a "Called" routine, the dummy variables it uses can not conflict with the ones in your Input processing table.
The four variables that I am using in table brw ( A W KY and SK ) can conflict with variables declared in your Automatic table. If any conflicts are found you will need to change the variable used by brw so as not to cause the conflict.
Below are two links to the code. One is to the brw processing table (in MSDOS format).
UNIX users should download this table, change the name to prc.brw and use vi to strip all the extra ^M at the end of each line.
The other link is to a MSDOS ZIP file name brw.zip that contains the two complete filePro files (brw and brwzip)
Internet explorer users can just click on a link and choose "Save to Disk", Netscape users use Shift Left Click and the save it to disk (thanks JP and Ken.)
If you still have problems I will gladly email it to you.
Download the brw.prc table only Download the complete brw.zip files
Howie and the Aljex Software Team.
|