SKIP

SKIP

Move the record pointer to a new position

Syntax

      SKIP [<nRecords>] [ALIAS <idAlias> | <nWorkArea>]

Arguments

<nRecords> is a numeric expression specifying the number of records to move the record pointer from the current position. A positive value moves the record pointer forward and a negative value moves the record pointer backward.

ALIAS <idAlias>|<nWorkArea> specifies the alias name as a literal identifier or the work area as a numeric expression.

SKIP specified with no arguments moves the record pointer forward one record.

Description

SKIP moves the record pointer to a new position relative to the current position in the current work area and within the current filter, if there is one. SKIP is generally used for operations, such as reporting, that need to go to the next record in a database file.

If the alias clause is specified, the pointer can be moved in another work area without SELECTing that work area. SKIP can move either forward or backward. If there is no active index, SKIP moves the record pointer relative to the current position in the target database file. If there is an active index, SKIP moves the pointer relative to the current position in the index instead of the database file.

Attempting to SKIP forward beyond the end of file positions the record pointer at LASTREC() + 1, and EOF() returns true (.T.). Attempting to SKIP backward beyond the beginning of file moves the pointer to the first record, and BOF() returns true (.T.).

In a network environment, any record movement command, including SKIP, makes changes to the current work area visible to other applications if the current file is shared and the changes were made during an RLOCK(). To force an update to become visible without changing the current record position, use SKIP 0. If, however, the changes were made during an FLOCK(), visibility is not guaranteed until the lock is released, a COMMIT is performed, or the file is closed. Refer to the “Network Programming” chapter for more information.

Examples

      .  This example uses SKIP with various arguments and shows their
         results:

      USE Customers NEW
      SKIP
      ? RECNO()                  // Result: 2
      SKIP 10
      ? RECNO()                  // Result: 12
      SKIP -5
      ? RECNO()                  // Result: 7

      .  This example moves the record pointer in a remote work area:

      USE Customers NEW
      USE Invoices NEW
      SKIP ALIAS Customers

      .  This example prints a report using SKIP to move the record
         pointer sequentially through the Customer database file:

      LOCAL nLine := 99
      USE Customers NEW
      SET PRINTER ON
      DO WHILE !EOF()
         IF nLine > 55
            EJECT
            nLine := 1
         ENDIF
            ? Customer, Address, City, State, Zip
            nLine++
            SKIP
         ENDDO
      SET PRINTER OFF
      CLOSE Customers

Seealso

BOF(), COMMIT, DBSKIP(), EOF(), GO, LOCATE, RECNO(), SEEK

CONTINUE

CONTINUE

Resume a pending LOCATE

Syntax

      CONTINUE

Description

CONTINUE is a database command that searches from the current record position for the next record meeting the most recent LOCATE condition executed in the current work area. It terminates when a match is found or end of file is encountered. If CONTINUE is successful, the matching record becomes the current record and FOUND() returns true (.T.); if unsuccessful, FOUND() returns false (.F.).

Each work area may have an active LOCATE condition. In Harbour, a LOCATE condition remains pending until a new LOCATE condition is specified. No other commands release the condition.

Notes

. Scope and WHILE condition: Note that the scope and WHILE condition of the initial LOCATE are ignored; only the FOR condition is used with CONTINUE. If you are using a LOCATE with a WHILE condition and want to continue the search for a matching record, use SKIP and then repeat the original LOCATE statement adding REST as the scope.

Examples

      .  This example scans records in Sales.dbf for a particular
         salesman and displays a running total sales amounts:
      LOCAL nRunTotal := 0
      USE Sales NEW
      LOCATE FOR Sales->Salesman = "1002"
      DO WHILE FOUND()
         ? Sales->Salesname, nRunTotal += Sales->Amount
         CONTINUE
      ENDDO
      .  This example demonstrates how to continue if the pending
      LOCATE scope contains a WHILE condition:
      LOCAL nRunTotal := 0
      USE Sales INDEX Salesman NEW
      SEEK "1002"
      LOCATE REST WHILE Sales->Salesman = "1002";
            FOR Sales->Amount > 5000
      DO WHILE FOUND()
         ? Sales->Salesname, nRunTotal += Sales->Amount
         SKIP
         LOCATE REST WHILE Sales->Salesman = "1002";
            FOR Sales->Amount > 5000
      ENDDO

Seealso

EOF(), FOUND(), LOCATE, SEEK

Found()

FOUND()

Determine the success of a previous search operation.

Syntax

      FOUND() --> lSuccess

Arguments

(This function has no arguments)

Returns

<lSuccess> A logical true (.T.) is successful; otherwise, false (.F.)

Description

This function is used to test if the previous SEEK, LOCATE, CONTINUE, or FIND operation was successful. Each wrk area has its own FOUND() flag, so that a FOUND() condition may be tested in unselected work areas by using an alias.

Examples

      nId := 100
      USE tests NEW INDEX tests
      SEEK nId
      IF FOUND()
         ? tests->Name
      ENDIF
      USE

Compliance

Clipper

Files

Library is rdd

Seealso

EOF()

C5_LOCATE

 LOCATE
 Search sequentially for a record matching a condition
------------------------------------------------------------------------------
 Syntax

     LOCATE [<scope>] FOR <lCondition>
        [WHILE <lCondition>]

 Arguments

     <scope> is the portion of the current database file in which to
     perform the LOCATE.  The default scope is ALL records.

     FOR <lCondition> specifies the next record to LOCATE within the
     given scope.

     WHILE <lCondition> specifies the set of records meeting the
     condition from the current record until the condition fails.

 Description

     LOCATE is a database command that searches for the first record in the
     current work area that matches the specified conditions and scope.  When
     you first execute a LOCATE, it searches from the beginning record of the
     scope for the first matching record in the current work area.  It
     terminates when a match is found or the end of the LOCATE scope is
     reached.  If it is successful, the matching record becomes the current
     record and FOUND() returns true (.T.).  If it is unsuccessful, FOUND()
     returns false (.F.) and the positioning of the record pointer depends on
     the controlling scope of the LOCATE.

     Each work area can have its own LOCATE condition.  The condition remains
     active until you execute another LOCATE command in that work area or the
     application terminates.

     LOCATE works with CONTINUE.  Once a LOCATE has been issued, you can
     resume the search from the current record pointer position with
     CONTINUE.  There are, however, some exceptions.  See note below.

 Notes

     .  CONTINUE: Both the <scope> and the WHILE condition apply only
        to the initial LOCATE and are not operational for any subsequent
        CONTINUE commands.  To continue a pending LOCATE with a scope or
        WHILE condition, use SKIP then LOCATE REST WHILE <lCondition> instead
        of CONTINUE.

 Examples

     .  These examples show typical LOCATEs:

        USE Sales INDEX Salesman
        LOCATE FOR Branch = "200"
        ? FOUND(), EOF(), RECNO()         // Result: .T. .F. 5
        LOCATE FOR Branch = "5000"
        ? FOUND(), EOF(), RECNO()         // Result: .F. .T. 85

     .  This example shows a LOCATE with a WHILE condition that is
        continued by using LOCATE REST:

        SEEK "Bill"
        LOCATE FOR Branch = "200" WHILE Salesman = "Bill"
        DO WHILE FOUND()
           ? Branch, Salesman
           SKIP
           LOCATE REST FOR Branch = "200" WHILE ;
                    Salesman = "Bill"
        ENDDO

 Files   Library is CLIPPER.LIB.

See Also: CONTINUE EOF() FOUND() SEEK SET FILTER

 

C5 Commands

 ?|??            Display one or more values to the console
 @...BOX         Draw a box on the screen
 @...CLEAR       Clear a rectangular region of the screen
 @...GET         Create a new Get object and display it
 @...PROMPT      Paint a menu item and define a message
 @...SAY         Display data at a specified screen or printer row and column
 @...TO          Draw a single- or double-line box
 ACCEPT*         Place keyboard input into a memory variable
 APPEND BLANK    Add a new record to the current database file
 APPEND FROM     Import records from a database (.dbf) file or ASCII text file
 AVERAGE         Average numeric expressions in the current work area
 CALL*           Execute a C or Assembler procedure
 CANCEL*         Terminate program processing
 CLEAR ALL*      Close files and release public and private variables
 CLEAR GETS      Release Get objects from the current GetList array
 CLEAR MEMORY    Release all public and private variables
 CLEAR SCREEN    Clear the screen and return the cursor home
 CLEAR TYPEAHEAD Empty the keyboard buffer
 CLOSE           Close a specific set of files
 COMMIT          Perform a solid-disk write for all active work areas
 CONTINUE        Resume a pending LOCATE
 COPY FILE       Copy a file to a new file or to a device
 COPY STRUCTURE  Copy the current .dbf structure to a new database (.dbf) file
 COPY STRU EXTE  Copy field definitions to a .dbf file
 COPY TO         Export records to a database (.dbf) file or ASCII text file
 COUNT           Tally records to a variable
 CREATE          Create an empty structure extended (.dbf) file
 CREATE FROM     Create a new .dbf file from a structure extended file
 DELETE          Mark records for deletion
 DELETE FILE     Remove a file from disk
 DELETE TAG      Delete a tag
 DIR*            Display a listing of files from a specified path
 DISPLAY         Display records to the console
 EJECT           Advance the printhead to top of form
 ERASE           Remove a file from disk
 FIND*           Search an index for a specified key value
 GO              Move the pointer to the specified identity
 INDEX           Create an index file
 INPUT*          Enter the result of an expression into a variable
 JOIN            Create a new database file by merging from two work areas
 KEYBOARD        Stuff a string into the keyboard buffer
 LABEL FORM      Display labels to the console
 LIST            List records to the console
 LOCATE          Search sequentially for a record matching a condition
 MENU TO         Execute a lightbar menu for defined PROMPTs
 NOTE*           Place a single-line comment in a program file
 PACK            Remove deleted records from a database file
 QUIT            Terminate program processing
 READ            Activate full-screen editing mode using Get objects
 RECALL          Restore records marked for deletion
 REINDEX         Rebuild open indexes in the current work area
 RELEASE         Delete public and private memory variables
 RENAME          Change the name of a file
 REPLACE         Assign new values to field variables
 REPORT FORM     Display a report to the console
 RESTORE         Retrieve memory variables from a memory (.mem) file
 RESTORE SCREEN* Display a saved screen
 RUN             Execute a DOS command or program
 SAVE            Save variables to a memory (.mem) file
 SAVE SCREEN*    Save the current screen to a buffer or variable
 SEEK            Search an order for a specified key value
 SELECT          Change the current work area
 SET ALTERNATE   Echo console output to a text file
 SET BELL        Toggle sounding of the bell during full-screen operations
 SET CENTURY     Modify the date format to include or omit century digits
 SET COLOR*      Define screen colors
 SET CONFIRM     Toggle required exit key to terminate GETs
 SET CONSOLE     Toggle console display to the screen
 SET CURSOR      Toggle the screen cursor on or off
 SET DATE        Set the date format for input and display
 SET DECIMALS    Set the number of decimal places to be displayed
 SET DEFAULT     Set the CA-Clipper default drive and directory
 SET DELETED     Toggle filtering of deleted records
 SET DELIMITERS  Toggle or define GET delimiters
 SET DESCENDING  Change the descending flag of the controlling order
 SET DEVICE      Direct @...SAYs to the screen or printer
 SET EPOCH       Control the interpretation of dates with no century digits
 SET ESCAPE      Toggle Esc as a READ exit key
 SET EXACT*      Toggle exact matches for character strings
 SET EXCLUSIVE*  Establish shared or exclusive USE of database files
 SET FILTER      Hide records not meeting a condition
 SET FIXED       Toggle fixing of the number of decimal digits displayed
 SET FORMAT*     Activate a format when READ is executed
 SET FUNCTION    Assign a character string to a function key
 SET INDEX       Open one or more order bags in the current work area
 SET INTENSITY   Toggle enhanced display of GETs and PROMPTs
 SET KEY         Assign a procedure invocation to a key
 SET MARGIN      Set the page offset for all printed output
 SET MEMOBLOCK   Change the block size for memo files
 SET MESSAGE     Set the @...PROMPT message line row
 SET OPTIMIZE    Change the setting that optimizes using open orders
 SET ORDER       Select the controlling order
 SET PATH        Specify the CA-Clipper search path for opening files
 SET PRINTER     Toggle echo of output to printer or set the print destination
 SET PROCEDURE*  Compile procedures and functions into the current object file
 SET RELATION    Relate two work areas by a key value or record number
 SET SCOPE       Change the boundaries for scoping keys in controlling order
 SET SCOPEBOTTOM Change bottom boundary for scoping keys in controlling order
 SET SCOPETOP    Change top boundary for scoping keys in controlling order
 SET SCOREBOARD  Toggle the message display from READ or MEMOEDIT()
 SET SOFTSEEK    Toggle relative seeking
 SET TYPEAHEAD   Set the size of the keyboard buffer
 SET UNIQUE*     Toggle inclusion of non-unique keys into an index
 SET WRAP*       Toggle wrapping of the highlight in menus
 SKIP            Move the record pointer to a new position
 SORT            Copy to a database (.dbf) file in sorted order
 STORE*          Assign a value to one or more variables
 SUM             Sum numeric expressions and assign results to variables
 TEXT*           Display a literal block of text
 TOTAL           Summarize records by key value to a database (.dbf) file
 TYPE            Display the contents of a text file
 UNLOCK          Release file/record locks set by the current user
 UPDATE          Update current database file from another database file
 USE             Open an existing database (.dbf) and its associated files
 WAIT*           Suspend program processing until a key is pressed
 ZAP             Remove all records from the current database file

 

OrdWildSeek()

OrdWildSeek()

Searches a value in the controlling index using wild card characters.
Syntax : OrdWildSeek( <cWildCardString>,; 
                      [<lCurrentRec>] , ;
                      [<lBackwards>] ) --> lFound

Arguments :

<cWildCardString> :

This is a character string to search in the controlling index. It may include 
the wild card characters "?" and "*". The question mark matches a single 
character, while the asterisk matches one or more characters.

<lCurrentRec> :

This parameter defaults to .F. (false) causing OrdWildSeek() to begin the 
search with the first record included in the controlling index. When .T. 
(true) is passed, the function begins the search with the current record.

<lBackwards> :

If .T. (true) is passed, OrdWildSeek() searches <cWildCardString> towards 
the begin of file. The default value is .F. (false), i.e. the function 
searches towards the end of file. 

Return :

The function returns .T. (true) if a record matching <cWildCardString> is 
found in the controlling index, otherwise .F. (false) is returned.

Description :

OrdWildSeek() searches a character string that may include wild card 
characters in the controlling index. This allows for collecting subsets 
of records based on an approximate search string. Records matching the 
search string are found in the controlling index, and the record pointer 
is positioned on the found record.

When a matching record is found, the function Found() returns .T. (true) 
until the record pointer is moved again. In addition, both functions, 
BoF() and EoF() return .F. (false).

If the searched value is not found, OrdWildSeek() positions the record 
pointer on the "ghost record" (Lastrec()+1), and the function Found() 
returns .F. (false), while Eof() returns .T. (true). The SET SOFTSEEK 
setting is ignored by OrdWildSeek().

Info :

See also: DbSeek(), LOCATE, OrdFindRec(), OrdKeyGoto(), WildMatch()

Category: Database functions, Index functions, extensions

Example :

// The example uses two wildcard search strings to show
// possible search results of OrdWildSeek()

PROCEDURE Main
   LOCAL aCust := {}

   USE Customer
   INDEX ON Upper(LastName) TO Cust01

   DO WHILE OrdWildSeek( "*MAN?", .T. )
     AAdd( aCust, FIELD->Lastname )
   ENDDO

   AEval( aCust, {|c| QOut(c) } )
   // Found records:
   // Dormann
   // Feldman

   GO TOP
   aCust := {}
   DO WHILE OrdWildSeek( "*EL*", .T. )
      AAdd( aCust, FIELD->Lastname )
   ENDDO

   AEval( aCust, {|c| QOut(c) } )
   // Found records:
   // Feldman
   // Hellstrom
   // Keller
   // Reichel
   USE
RETURN

Note : Harbour has this function without documentation. This page borrowed 
from xHarbour and not tested. Please beware about Unicode.

C5 Database Commands

Database Commands and Statements

APPEND BLANK

Add a new record to current database file.

APPEND BLANK

APPEND FROM :

Import records from a (.dbf) or ASCII file

APPEND FROM <xcFile>
     [FIELDS <idField list>]
     [<scope>] 
     [WHILE <lCondition>] 
     [FOR <lCondition>]
     [SDF | DELIMITED [WITH BLANK | <xcDelimiter>] |
     [VIA <xcDriver>]]

AVERAGE :

Average numeric expressions in the current work area

AVERAGE <nExp list> TO <idVar list> 
     [<scope>] 
     [WHILE <lCondition>] 
     [FOR <lCondition>]

CLEAR ALL* :

Close files and release public and private variables.

CLEAR ALL

CLOSE :

Close a specific set of files

CLOSE [<idAlias> | ALL | ALTERNATE | DATABASES | FORMAT |INDEXES ]

COMMIT :

Perform a solid-disk write for all active work areas

COMMIT

CONTINUE :

Resume a pending LOCATE

CONTINUE

COPY STRUCTURE :

Copy the current (.dbf) structure to a new (.dbf) file

COPY STRUCTURE [FIELDS <idField list>] TO <xcDatabase>

COPY STRUCTURE EXTENDED :

Copy field definitions to a (.dbf) file

COPY STRUCTURE EXTENDED TO <xcExtendedDatabase>

COPY TO :

Export records to a new (.dbf) or ASCII file

COPY [FIELDS <idField list>] TO <xcFile>
     [<scope>] 
     [WHILE <lCondition>] 
     [FOR <lCondition>]
     [SDF | DELIMITED [WITH BLANK | <xcDelimiter>] |
     [VIA <xcDriver>]]

COUNT :

Tally records to a variable

COUNT TO <idVar>
     [<scope>] 
     [WHILE <lCondition>] 
     [FOR <lCondition>]

CREATE :

Create an empty structure extended (.dbf) file

CREATE <xcExtendedDatabase>

CREATE FROM :

Create a new (.dbf) file from a structure extended file

CREATE <xcDatabase> 
    FROM <xcExtendedDatabase> 
    [NEW]
    [ALIAS <xcAlias>] 
    [VIA <cDriver>]

DELETE :

Mark records for deletion

DELETE [<scope>] 
    [WHILE <lCondition>]
    [FOR <lCondition>]

FIELD :

Declare database field names

FIELD <idField list> [IN <idAlias>]

FIND* :

Search an index for a specified key value

FIND <xcSearchString>

GO :

Move the record pointer to a specific record

GO[TO] <nRecord> | BOTTOM | TOP

JOIN :

Merge two (.dbf) files to create a new (.dbf) file

JOIN WITH <xcAlias> TO <xcDatabase>
     FOR <lCondition> 
     [FIELDS <idField list>]

LOCATE :

Search sequentially for a record matching a condition

LOCATE [<scope>] 
    FOR <lCondition>
    [WHILE <lCondition>]

PACK :

Remove deleted records from a database file

PACK

RECALL :

Restore records marked for deletion

RECALL [<scope>] 
     [WHILE <lCondition>]
     [FOR <lCondition>]

REPLACE :

Assign new values to field variables

REPLACE <idField> WITH <exp>
    [, <idField2> WITH <exp2>...]
    [<scope>] 
    [WHILE <lCondition>] 
    [FOR <lCondition>]

SEEK :

Search an index for a specified key value

SEEK <expSearch>

SELECT :

Change the current work area

SELECT <xnWorkArea> | <idAlias>

SET DELETED :

Toggle filtering of deleted records

SET DELETED on | OFF | <xlToggle>

SET EXCLUSIVE :

Establish shared or exclusive USE of database files

SET EXCLUSIVE ON | off | <xlToggle>

SET FILTER :

Hide records not meeting a condition

SET FILTER TO [<lCondition>]

SET  MEMOBLOCK :

     Change the block size for memo files

     SET MEMOBLOCK TO <nSize>

SET PATH :

Specify the search path for opening files

SET PATH TO [<xcPathspec list>]

SET RELATION :

Relate two work areas by a key value or record number

SET RELATION TO [<expKey> | <nRecord> INTO <xcAlias>]
    [, [TO] <expKey2> | <nRecord2> INTO <xcAlias2>...]
    [ADDITIVE]

SET SOFTSEEK :

Toggle relative SEEKing

SET SOFTSEEK on | OFF | <xlToggle>

SET UNIQUE :

Toggle the inclusion of nonunique keys into an index

SET UNIQUE on | OFF | <xlToggle>

SKIP :

Move the record pointer to a new position

SKIP [<nRecords>] [ALIAS <idAlias> | <nWorkArea>]

SORT :

Copy to a (.dbf) file in sorted order

SORT TO <xcDatabase> ON <idField> [/[A | D][C]]
    [, <idField2> [/[A | D][C]]...]
    [<scope>] 
    [WHILE <lCondition>] 
    [FOR <lCondition>]

SUM :

Sum numeric expressions to variables

SUM <nExp list> TO <idVar list>
    [<scope>] 
    [WHILE <lCondition>] 
    [FOR <lCondition>]

TOTAL

Summarize records by key value to a (.dbf) file

TOTAL ON <expKey> FIELDS <idField list>
    TO <xcDatabase>
    [<scope>] 
    [WHILE <lCondition>] 
    [FOR <lCondition>]

UNLOCK :

Release file/record locks set by the current user

     UNLOCK [ALL]

UPDATE : 

Update current database file from another database file

UPDATE FROM <xcAlias>
   ON <expKey> [RANDOM]
   REPLACE <idField> WITH <exp>
   [, <idField2> WITH <exp2>...]

USE

Open an existing (.dbf) and its associated files

USE [<xcDatabase>
    [INDEX <xcIndex list>]
    [ALIAS <xcAlias>] 
    [EXCLUSIVE | SHARED]
    [NEW] [READONLY]
    [VIA <cDriver>]]

ZAP

Remove all records from the current database file

ZAP