home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Monster Media 1993 #2
/
Image.iso
/
database
/
p4w_all.zip
/
TI1310.ASC
< prev
next >
Wrap
Text File
|
1993-05-04
|
3KB
|
133 lines
PRODUCT : Paradox for Windows NUMBER : 1310
VERSION : 1.0
OS : WIN
DATE : May 4, 1993 PAGE : 1/2
TITLE : Scan Loop to Place the Record Number in a Regular
Field
This document demonstrates a script that uses SCAN to place the
record number in a regular field. The main purpose of a scan
loop is to examine each record of a table and execute ObjectPAL
instructions for that record.
To use the script you will need to have a field in your table to
store the record number. If you don't already have a numeric
field in your table for the record number, you will need to
restructure your table. When you create the script, you will
need to substitute your own table name for TBLNAME and the field
name that you wish to change for FLDNAME (your record number
field).
Before making global changes to your table, it is a good idea to
first make a backup copy.
Creating the Script
Choose File | New | Script. Your script should ultimately
resemble the following:
method run(var eventInfo Event)
Var
tc tCursor
tv tableview
Endvar
tc.open("TBLNAME") ; Change TBLNAME to your
; table name.
tc.edit()
scan tc:
tc."FLDNAME" = tc.recno() ; Change FLDNAME to
; your field name.
endScan
tc.endedit()
tc.close()
tv.open("TBLNAME") ; View the table.
tv.bringToTop()
endmethod
PRODUCT : Paradox for Windows NUMBER : 1310
VERSION : 1.0
OS : WIN
DATE : May 4, 1993 PAGE : 2/2
TITLE : Scan Loop to Place the Record Number in a Regular
Field
NOTE: The semicolon ";" indicates that a comment follows. The
comment will not be processed when when you play the
script.
Check the Syntax
After you have typed in the script on the previous page, choose
Language | Check Syntax. The compiler examines the code and
identifies if there are syntax errors in the method. It displays
a message in the status line of the open Editor window, such as
"No syntax errors" or a description of the syntax error. If
there is a syntax error, Paradox positions the cursor at the
point of the error. Before you can run the script, you will need
to correct your code and choose Language | Check Syntax again
until there are no remaining syntax errors.
When there are no syntax errors:
1. Choose File | Save, type in a filename in the edit box,
then choose OK.
2. To run the script, press [F8]. Your script will play, and
display your table in View mode.
A complete description of SCAN can be found in Chapter 3 of the
ObjectPAL Reference Guide. For information on Restructuring
Tables, refer to Chapter 9 of the User's Guide.
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.