1

The Lost Secrets Of Lookup()...
by Michael Meer
(Ed. Note: This article first appeared in The Pinter
FoxPro Letter. It is reprinted here with permission from
both the author and Les Pinter, publisher of The Pinter
FoxPro Letter.]

Would you like to replace 25 lines of code that execute in .066 seconds with one command that executes in .002 seconds? Would you like to eliminate the need to set relations between your main tables and the lookup tables in your screens just to display some field from the lookup table? Or maybe eliminate the need to tie those lookup tables into your queries, thus speeding them up for reports?

Good, now I have your attention, Lookup() is a powerful command that is highly underrated. The Foxpro 2.6 online help describes Lookup() as a function that “searches a table/.dbf for the first record with a field matching the specified expression.’ This simple explanation doesn’t begin to give you the power of LookupQ. To understand what Lookup() is actually doing, we will explore a UDF that has the same functionality.

First, the UDF must accept the same four parameters that LookupO accepts. These parameters are the return field’s name, the search key, the locate field name and the tag name.

PARAMETERS pcRetFld, pcKey, pcSeekFld, pcTagName


In the next section of the UDF, we must declare some
private variables and save the current work area.
PRIVATE jcCurrentAllas,;
JcCurrentOrder,;
JcType,;
jReturn Value jcCurrentAlias ALIAS()
(Con't, page 7)
February 19, 1996, 7:30 PM - David Ingersoll, Select
Software Tools. David will be presenting Select OMT
Professional, a modeling tool for classes and use
classes, and its companion product, The Document
Generator.

March 18, 1996, 7:30 PM - Sally Wong, Computer Resources Technology. Sally will be presenting a system modeling toOl, FoxCase (distributed exclusively in the US by Neon Software), that enables developers to design and work through their system model, review their assumptions, identify redundant fields and relationships, produce a logic diagram (among others), etc., and then output to the VFP DBC. She’ll also be bringing a copy of the software to raffle off. (Only paid-up members will be eligible for the drawing.)

April 15, 1996, 7:30 PM - Jonathon Melvin and Roger Woodsmall. Jon will be talking about and demonstrating using VFP to develop aps, frameworks, and class libraries. Roger will be returning with his latest version of AutoManual. To jog everyone’s memory, Roger demonstrated his DOS product to LA Fox about 1-1/2 years ago and everyone asked him about a Windows version. (What this product does is automatically generate end- user documentation for any FoxPro application to a MS Word file.) He immediately started working on a Windows product and just about the time it was close to
(Con't, page 2)
The LA Fox Developer
A Newsletter for FoxPro Application Developers in Southern California
February 1996
Out and About
by Barry R. Lee
The February meeting of LA Fox will be held on Feb.19, 1996, at 7:30 PM at our regular meeting place (the Torrance Airport, 3301 Airport Drive, in Torrance). For details on how to get there, see the map on the back page.
In this issue
Developing EXE’s in VFP
Page 3
Polymorphism Explained
Page 4
Simple Stuff
Page 6
VFP SCATTER NAME Command
Page 9
and more!

1