3

The LA Fox Developer Newsletter
August 1997
Save the Environment
By Arnon Gal-Oz
VFP (and FP2.x before it) gives the developer a lot of control
over the environment at run time. This includes commands that
lets you set basic things like what century we are in (SET
CENTURY TO), different sethngs related to localization (e.g.
SET DATE TO or SET CURRENCY TO), stuff that affect
searching and string matching (like SET ANSI, SET COLLATE),
and stuff that affects the way VFP works in general (like SET
MULTI LOCKS, SET EXCLUSIVE).

It is very worthwhile for any beginner VFP developer to check
the SET section of the VFP help file to find what all these
commands can do for you. While I am at it, another section of
the help file worth reading is the SYSO section, there are many
functions there that otherwise are not part of the language,
which lets you do some interesting stuff. While this does not fall
under the subject of this article I’ll just mention 2 or 3 interesting
SYS functions. For example sys(3O54) lets you see the optimi-
zation level of your SELECT statements, SYS(1270) will give
you a reference to the object under the mouse or at a specific X/
Y, and SYS(2333) is needed when you want to use an OCX
created in VB5.

Now returning to our business, many of the different SETtings
will not change throughout the application, and indeed a lot of
FP2.x programs started with a bunch of SET commands in the
main program like SET TALK OFF, SET EXCLUSiVE OFF etc.

One of the new concepts added in VFP is the private
datasession, this brings a lot of good and saves some program-
ming effort. For example it is now very easy to have the same
form open twice each time with a different record, in earlier
versions you had to do some programming to make this hap-
pen. However this prevents you from using the same technique
described above of setting all your SETs in the main program.
Because many of the SET commands are scoped to the
datasession, they are reset to default values for each instance
of a form and have to be set manually. The table below lists the
SET commands that are scoped to the datasession:

ANSI
BLOCKSIZE
CENTURY
CONFIRM
DATABASE
CARRY
COLLATE
CURRENCY
DATE
DELETED
DECIMALS
EXCLUSIVE
FIXED
LOCK
MEMOWDTH
EXACT
HOURS
MULTILOCKS
NULL
REPROCESS
NEAR
POINT
TALK
SAFETY
AUTOSAVE
SECONDS
SYSFORMATS
UNIQUE

Note that to set them to the value you want before any table is
loaded, you have to set them in the BeforeOpenTables event of
the DataEnvironment. If you don’t use a DataEnvironemnt, or
(Con’t, page 4)
Special Big Announcement
The LA Fox Developer's Group has entered into an agree-
ment with Macmillan Computer Publishing. LA Fox mem-
bers can now purchase all Macmillan Computer Publishing
titles at a discount of 30% off retail pricing.

Macmillan owns the following publishers:
Que
New Riders Press
The Waite Group
Ziff-Davis
Sams/sams.net
Que Education & Training
Macmillan Technical Publishing
Hayden
Adobe Press
Borland Press
Lycos Press

With all these publishers and over 40% market share,
Macmillan has the best books for computer technology.

To take advantage of this offer, you must be a member-in-good-
standing (read current and paid-up) and have a credit card. You
can receive our special account number and the 800 access
number by calling me at 800/499-6237 or 714/375-3300, ore-
mailing me at CompuServe (72723,3422) or brlee@earthlink.net.


On-Line Updates
The online update document for Mastering Visual FoxPro is now
available. This document, designed to be used with the Master-
ing Visual FoxPro CD-ROM-based training product, covers the
new features and differences between Visual FoxPro 3.0 and
Visual FoxPro 5.0. Now you can use the advanced features of
the Visual FoxPro Web site to quickly explore the contents of
this useful learning tool and shorten your learning curve for
Visual FoxPro 5.0! This document is also available for download
at http://www.microsoft.com/vfoxpro/.

Appendix Added to Update Document - Micro Endeavors
Appendix. Microsoft has added the comprehensive Micro
Endeavors Appendix of FoxPro vs. Visual FoxPro language
changes to the Mastering Visual FoxPro CD Update Document.
Also available for download at http://www.microsoft.com/vfoxpro/
Page 3

3