Quote:Yes, you can speed up the XLookup - without making it internal. Using an external XLookup, you can put an XLookup in the GLOBAL CODE section. It will run when the form is opened. It can even be a "bad" Xlookup, using an non-existent LE name in the key field. Just make sure it uses the same .db file as the "real" XLookup that will run later. Then, put the "real" XLookup in the event where it is really supposed to go.
The XLookup in GLOBAL CODE will run first, so the form will take a few moments to open, but subsequent XLookups to the same .db file will be much much faster.
In general, the first XLookup to any .db file will be slow. Subsequent XLookups will be as fast as internal XLookups. So this technique works by moving the first XLookup "out of the way".
This applies to any of the "X" commands.
As an example, try this in Customers.db:
------------------------------------
in GLOBAL CODE:
var str as string
str = @XLookup("c:\Sesame\Data\Samples\ZipCode.db", "Hiram", "xxxxxCity", "Zip Code")
writeln(str)
------------------------------------
in Company ON EXIT
var str as string
str = @XLookup("c:\Sesame\Data\Samples\ZipCode.db", "Hiram", "City", "Zip Code")
writeln(str)
------------------------------------
The XLookup in in GLOBAL CODE will run just before the form opens, effectively "internalizing" the ZipCode.db. Then when you exit the Company LE, the second XLookup will run nearly instanteously.
Mark, back in Feb 2004, you showed technique to speed up xlookup by looking up once in GlobalCode from that particular file once and I guess that kept it open and speed up the consequent lookups commands from that particular file.
Even if you replace the var to stat for variable declaration in GlobalCode that is required after ver 1.1.4 of Sesame, this code does not work and it throws up a lot of other errors along with it. Did something change in the later versions other than declaration of variable as stat in GlobalCode?