xHarbour Reference Documentation > Function Reference xHarbour Developers Network  

DbSort()

Creates a new, physically sorted database.

Syntax

DbSort( <cDatabase>, ;
        <aFields>  , ;
       [<bFor>]    , ;
       [<bWhile>]  , ;
       [<nNext>]   , ;
       [<nRecord>] , ;
       [<lRest>]     ) --> lSuccess

Arguments

<cDatabase>
This is a character string holding the name of the database file to create. It can include path and file extension. When no path is given, the file is created in the current directory. The default file extension is DBF.
<aFields>
A one dimensional array holding the names of database fields to sort must be specified. Each element of the array holds a character string with a field name. The character string may be extended by a flag specifying the sort order. /A is the ascending flag (default), /D means descending sort, and /C is relevant for case insensitive sorting of character fields.
<bFor>
This is an optional code block which must return a logical value. The sorted records are added to the target database when <bFor> yields .T. (true), otherwise they are ignored.
<bWhile>
This is an optional code block which must return a logical value. DbSort() returns immediately as soon as <bWhile> yields .F. (false).
<nNext>
An optional numeric parameter restricting the number of records to sort to <nNext>, beginning with the current record.
<nRecord>
Only a single record is processed when the record number <nRecord> is specified.
<lRest>
An optional logical value that defaults to .F. (false). Specifying .T. (true) causes DbList() to start output with the current record and continue until the end of file is reached.

Return

The function returns .T. (true) on success, and .F. (false) on failure.

Description

DbSort() is the functional equivalent of the SORT command. Refer to SORT for a detailed description of sorting records into a new database file.

Info

See also:INDEX, OrdCreate(), SORT
Category: Database functions , xHarbour extensions
Source:rdd\dbsort.prg
LIB:xhb.lib
DLL:xhbdll.dll


Copyright © 2006-2007 xHarbour.com Inc. All rights reserved.
http://www.xHarbour.com
Created by docmaker.exe