home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC Press 1997 July
/
Sezamfile97_1.iso
/
msdos
/
database
/
pdx_ti2.arj
/
TI1213.ASC
< prev
next >
Wrap
Text File
|
1993-01-14
|
5KB
|
199 lines
PRODUCT : Paradox NUMBER : 1213
VERSION : All
OS : DOS
DATE : January 14, 1993 PAGE : 1/3
TITLE : Generating Incremental Values Using SETKEY
This Technical Information Sheet illustrates how to generate
incremental values by using a SETKEY macro. The following one
line PAL script takes the maximum numeric value from the field
named "fieldname" , increments it by one, and assigns the new
value to the field named "fieldname". The PAL commands and
functions that are featured in the script are the SETKEY command
and the CMAX() function.
Note: The SETKEY macro presented in this Technical Information
Sheet is intended for a single user working in interactive mode.
It is not intended to be used in a network environment. For
information on generating incremental values in a in a PAL
application or in a network environment, refer to TI 662.
The PAL code in the script below should be placed in an Init
script in the private directory. If you aren't using a private
directory, then the Init script should be in the directory where
Paradox was installed, for example PDOX40. The Init script is a
Paradox program that runs automatically when Paradox is started
like an Autoexec.bat file runs automatically when a computer is
booted.
To create the script:
1. The following instructions assume that you do not have an
existing Init script. If you do have an existing Init
script, skip to number 4 on the next page. Change your
working directory to your private directory. From the
Paradox Menu, select Tools | More | Directory , then type
in the path name of your private directory (if you don't
have a private directory this should be the directory
where Paradox is installed, i.e. C:\PDOX40).
2. From the Paradox Menu, select Scripts | Editor | New
(for versions earlier than 4.0, select Scripts | Editor |
Write).
3. At the prompt, type "Init" as the name of your script
(don't type it in quotes). If Paradox prompts you with
the message "Scriptname file already exists" and gives you
the option of Cancel | Replace, select Cancel, then skip
to number 4 on the next page, otherwise skip to number 5.
PRODUCT : Paradox NUMBER : 1213
VERSION : All
OS : DOS
DATE : January 14, 1993 PAGE : 2/3
TITLE : Generating Incremental Values Using SETKEY
4. If you have an existing Init script, edit the Init script
by selecting Scripts | Editor | Open (for versions earlier
than 4.0, select Scripts | Editor | Edit), type "Init" for
the script name (don't type it in quotes).
5. You are now in the Script Editor, type in the PAL code
below.
6. When you are finished typing in the PAL code, press <F2>
to save the script.
; The script begins here
SETKEY -23 [Fieldname]=CMAX("tablename","fieldname")+1
; The script ends here
In your script, substitute your own field name and table name for
"fieldname" and "tablename". In the script above, any characters
after the ";" including the ";" need not be entered. They are
only comments. The SETKEY macro featured on the previous page
will only function properly when you are in Edit or Coedit Mode
and when the fieldname is a numeric data type. It is designed
for single user interactive use only. For information on
generating incremental values in a PAL application or in a
network environment, refer to TI 662.
The PAL script above assigns the PAL code to Alt-I (where -23 is
the extended code for Alt-I). Alt-I is just one possible code
that you can assign to the PAL script. See Appendix G of the PAL
Reference Guide for a list of Keycodes Recognized by Paradox (for
versions earlier than 4.0, refer to Appendix B of the PAL User's
Guide).
Paradox will execute the command, every time you press the
assigned key (i.e. Alt-I).
PRODUCT : Paradox NUMBER : 1213
VERSION : All
OS : DOS
DATE : January 14, 1993 PAGE : 3/3
TITLE : Generating Incremental Values Using SETKEY
For additional information on the SETKEY command, refer to the
PAL Programmer's Guide and the PAL Reference Guide (for versions
earlier than 4.0, refer to the PAL User's Guide). Other methods
of generating incremental values are presented in Technical
Information Sheet #662.
DISCLAIMER: You have the right to use this technical information
subject to the terms of the No-Nonsense License Statement that
you received with the Borland product to which this information
pertains.