home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1993 #2 / Image.iso / database / p4w_all.zip / TI1310.ASC < prev    next >
Text File  |  1993-05-04  |  3KB  |  133 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.   PRODUCT  :  Paradox for Windows                   NUMBER  :  1310
  8.   VERSION  :  1.0
  9.        OS  :  WIN
  10.      DATE  :  May 4, 1993                              PAGE  :  1/2
  11.  
  12.     TITLE  :  Scan Loop to Place the Record Number in a Regular
  13.               Field
  14.  
  15.  
  16.  
  17.  
  18.   This document demonstrates a script that uses SCAN to place the
  19.   record number in a regular field.  The main purpose of a scan
  20.   loop is to examine each record of a table and execute ObjectPAL
  21.   instructions for that record.
  22.  
  23.   To use the script you will need to have a field in your table to
  24.   store the record number.  If you don't already have a numeric
  25.   field in your table for the record number, you will need to
  26.   restructure your table.  When you create the script, you will
  27.   need to substitute your own table name for TBLNAME and the field
  28.   name that you wish to change for FLDNAME (your record number
  29.   field).
  30.  
  31.   Before making global changes to your table, it is a good idea to
  32.   first make a backup copy.
  33.  
  34.   Creating the Script
  35.  
  36.   Choose File | New | Script.  Your script should ultimately
  37.   resemble the following:
  38.  
  39.       method run(var eventInfo Event)
  40.       Var
  41.          tc   tCursor
  42.          tv   tableview
  43.       Endvar
  44.  
  45.       tc.open("TBLNAME")                  ; Change TBLNAME to your
  46.                                           ;   table name.
  47.       tc.edit()
  48.  
  49.       scan tc:
  50.          tc."FLDNAME" = tc.recno()            ; Change FLDNAME to
  51.                                               ;   your field name.
  52.       endScan
  53.  
  54.       tc.endedit()
  55.       tc.close()
  56.       tv.open("TBLNAME")                      ; View the table.
  57.       tv.bringToTop()
  58.       endmethod
  59.    
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73.   PRODUCT  :  Paradox for Windows                   NUMBER  :  1310
  74.   VERSION  :  1.0
  75.        OS  :  WIN
  76.      DATE  :  May 4, 1993                              PAGE  :  2/2
  77.  
  78.     TITLE  :  Scan Loop to Place the Record Number in a Regular
  79.               Field
  80.  
  81.  
  82.  
  83.  
  84.   NOTE: The semicolon ";" indicates that a comment follows.  The
  85.         comment will not be processed when when you play the
  86.         script.
  87.  
  88.  
  89.   Check the Syntax
  90.  
  91.   After you have typed in the script on the previous page, choose
  92.   Language | Check Syntax.  The compiler examines the code and
  93.   identifies if there are syntax errors in the method.  It displays
  94.   a message in the status line of the open Editor window, such as
  95.   "No syntax errors" or a description of the syntax error.  If
  96.   there is a syntax error, Paradox positions the cursor at the
  97.   point of the error.  Before you can run the script, you will need
  98.   to correct your code and choose Language | Check Syntax again
  99.   until there are no remaining syntax errors.
  100.  
  101.   When there are no syntax errors:
  102.  
  103.      1.  Choose File | Save, type in a filename in the edit box,
  104.          then choose OK.
  105.  
  106.      2.  To run the script, press [F8].  Your script will play, and
  107.          display your table in View mode.
  108.  
  109.  
  110.   A complete description of SCAN can be found in Chapter 3 of the
  111.   ObjectPAL Reference Guide.  For information on Restructuring
  112.   Tables, refer to Chapter 9 of the User's Guide.
  113.  
  114.  
  115.   DISCLAIMER: You have the right to use this technical information
  116.   subject to the terms of the No-Nonsense License Statement that
  117.   you received with the Borland product to which this information
  118.   pertains.
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.