TIP: Click on subject to list as thread! ANSI
echo: foxpro
to: ALL
from: DEN BARNES
date: 1997-01-26 23:42:00
subject: fPro Programming Pearl #1

Excerpts from an article by Miriam Liskin in Computer Currents March, 1986
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       "The default size of the typeahead buffer is now 20 characters,
you can increase this (up to a limit of 32,000 characters) with the SET
TYPEAHEAD TO  command. For example, to establish a 200 character
typeahead buffer, you would use:
                SET TYPEAHEAD TO 200
You might want to use an entry in CONFIG.FP to avoid repeatedly typing
the same SET command. The CONFIG.FP entry would look like this:
                TYPEAHEAD = 200
        FoxPro maintains a "history" of the last few commands you have
typed. You use the / and / to
move through the list of available commands, and when you see the
command you want next to the cursor, you can edit it if necessary, and
then press  to resubmit the command line.
(You can split lengthy commands, such as a SQL select, that extend
beyond the right margin, by adding a space and a semicolon at the end of
a line.)
        The SCOPE parameter, "REST" which means all the records from the
current position of the record pointer to the end of the file (or end of
the index, if one is open). REST is especially useful for restarting a
LIST, REPORT, or LABEL, command from the point of interruption, if, for
example, you have temporarily stopped a long LIST to examine one record,
or in the event of a printer jam. You can use SKIP , SKIP , GOTO,
FIND, or SEEK to position the record pointer, and then repeat your
command (perhaps by retrieving it from history) with the scope REST.
        MAX() and MIN() offer a limited type of decision-making
capability without programming. For example, suppose that in Computer
Currents system we've been describing, you wanted to print a report that
listed, for each advertiser, the BALANCE field and the minimum payment
due, which is either $50 or 20% of the outstanding balance, whichever is
higher. In a program, you could use an IF ... ELSE ... ENDIF structure
to make this choice:
        IF (BALANCE * .2) > 50
          @ L,50 SAY BALANCE * .2
        ELSE
          @ L,50 SAY 50.00
        ENDIF
        You can make other types of decisions with the IIF() function.
(That's not a typographical error, the name of the function really is
spelled with two I;s.) This function works much like the @IF function
in many spreadsheet programs. The IIF() function has three inputs: the
condition to be tested, the expression to return if the condition is
true, and the expression to return if the condition is false. In a
program, this construction is more concise, more readable, and executes
somewhat faster than the equivalent IF ... ELSE ... ENDIF structure. It
is even more valuable at the command level, where it allows you to LIST
alternative values of a expression, or include conditional expressions
in reports or labels. The example used to illustrate the MAX() function
could also be written as:
        IFF((BALANCE * .2) < 50,
        BALANCE * .2, 50.00) . "
--- TMail v1.31.5
---------------
* Origin: Diablo Valley PCUG-BBS, Walnut Creek, CA 510/943-6238 (1:161/55)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.