SELECT

SELECT

Change the current work area

Syntax

      SELECT <xnWorkArea> | <idAlias>

Arguments

<xnWorkArea> is the work area number between 0 and 250 inclusive. This argument is an extended expression and can be specified either as a literal number or as a numeric expression enclosed in parentheses.

<idAlias> is the name of an existing work area to SELECT if there is a database file open in that area.

Description

SELECT is a database command that changes work areas. CA-Clipper supports 250 work areas, with each work area a logical handle to an open database file and all of its attributes. You can refer to work areas with SELECT by number or by alias. The alias of a work area is automatically assigned when a database file is USEd in that work area or by using the ALIAS clause.

Work area 0 refers to the first empty or next available work area. Using this, you can SELECT 0 and USE <xcDatabase> as a method of opening database files.

Notes

. Aliased expressions: Aliased expressions are a much more powerful method of selecting new work areas than the SELECT command. Instead of SELECTing a work area, and then performing an operation for that work area, you can apply an alias to an expression that performs the operation. This is done by specifying the alias of the remote work area and the expression enclosed in parentheses. For example, to access the value of EOF() in an unselected work area, you would normally execute a series of statements like the following:

            SELECT Remote
            ? EOF()
            SELECT Main

Using the aliased expression form, these statements become:

            ? Remote->(EOF())

. USE…NEW: Instead of using SELECT0 and USE <xcDatabase> to open a database file in a new work area, the preferred method is to USE <xcDatabase> NEW.

Examples

      .  This example opens a series of database files by SELECTing
         each work area by number then USEing each database file in that
         work area:

         SELECT 1
         USE Customer
         SELECT 2
         USE Invoices
         SELECT 3
         USE Parts
         SELECT Customer

      .  A better method is to open each database in the next available
         work area by specifying the NEW clause on the USE command line.
          In this example USE...NEW is employed instead of SELECT 0 and
         then USE:

         USE Customer NEW
         USE Invoices NEW

         SELECT Customer

      .  This code fragment changes work areas while saving the current
         work area name to a variable using the SELECT() function.  After
         executing an operation for the new work area, the original work
         area is restored:

         nLastArea := SELECT()
         USE Newfile NEW
         //
         <statements>...
         //
         SELECT (nLastArea)

Seealso

ALIAS(), EOF(), SELECT(), SET INDEX, USE, USED()

Harbour All Functions – A

AAdd
Abs
AChoice
AClone
ACopy
ACos

ADays
AddASCII
AddMonth
ADel
ADir
AfterAtNum
AEval
AFields
AFill
AIns
Alert
Alias
AllTrim

AMonths
Array
Asc
AScan
ASCIISum
ASCPos
ASin
ASize
ASort
At
AtAdjust
ATail
ATan
ATn2
AtNum
AtRepl
AtToken

Harbour Database Functions

Database Functions

AFields Fills referenced arrays with database field information
Alias Returns the alias name of a work area
BOF Test for the beggining-of-file condition
dbAppend Appends a new record to a database file
dbClearFilter Clears the current filter condiction in a work area
dbCloseAll Close all open files in all work areas.
dbCloseArea Close a database file in a work area
dbCommit Updates all index and database buffers for a given workarea
dbCommitAll Flushes the memory buffer and performs a hard-disk write
dbCreate Creates an empty database from a array
dbDelete Mark a record for deletion in a database
dbEval Performs a code block operation on the current Database
DBF Alias name of a work area
dbFilter Return the filter expression in a work area
dbGoBottom Moves the record pointer to the bottom of the database
dbGoto Position the record pointer to a specific location
dbGoTop Moves the record pointer to the top of the database
dbRecall Recalls a record previousy marked for deletion
dbSeek Searches for a value based on an active index
dbSelectArea Change to another work area
dbSetDriver Establishes the RDD name for the selected work area
dbSetFilter Establishes a filter condition for a work area
dbSkip Moves the record pointer in the selected work area
dbSkipper Helper function to skip a database
dbStruct Builds a multidimensional array of a database structure
dbUseArea Opens a work area and uses a database file
Deleted Tests the record’s deletion flag
EOF Test for end-of-file condition
FCount Counts the number of fields in an active database
FieldDeci Determines the number of decimal places of a given numeric field
FieldGet Obtains the value of a specified field
FieldName Return the name of a field at a numeric field location
FieldPos Return the ordinal position of a field
FieldPut Set the value of a field variable
FieldSize Determines the size of a given field
FieldType Determines the type of a given field
Found Determine the success of a previous search operation
Header Return the length of a database file header
LastRec Returns the number of records in an active work area or database
LUpdate Yields the date the database was last updated
RecCount Counts the number of records in a database
RecNo Returns the current record number or identity
RecSize Returns the size of a single record in an active database
Select Returns the work area number for a specified alias
Used Checks whether a database is in use in a work area

ordCondSet()

ORDCONDSET()

Set the Condition and scope for an order

Syntax

      ORDCONSET([<cForCondition>],
        [<bForCondition>],
        [<lAll>],
        [<bWhileCondition>],
        [<bEval>],
        [<nInterval>],
        [<nStart>],
        [<nNext>],
        [<nRecord>],
        [<lRest>],
        [<lDescend>],
        [<lAdditive>],
        [<lCurrent>],
        [<lCustom>],
        [<lNoOptimize>])

Arguments

<cForCondition> is a string that specifies the FOR condition for the order.

<bForCondition> is a code block that defines a FOR condition that each record within the scope must meet in order to be processed. If a record does not meet the specified condition, it is ignored and the next record is processed.Duplicate keys values are not added to the index file when a FOR condition is Used.

Compliance

Clipper

Files

Library is rdd

ordBagName()

ORDBAGNAME()

Returns the Order Bag Name.

Syntax

      ORDBAGNAME(<nOrder> | <cOrderName>) --> cOrderBagName

Arguments

<nOrder> A numeric value representing the Order bag number.

<cOrderName> The character name of the Order Bag.

Returns

ORDBAGNAME() returns the Order bag name

Description

This function returns the name of the order bag for the specified work area. If <nOrder> is specidied, it will represent the position in the order list of the target order. If <cOrderName> is specified, it will represent the name of the target order. In essence, it will tell the name of the database (if That Rdd is in use) for a given index name or index order number. If <cOrderName> is not specified or <nOrder> is 0, the Current active order will be used.

Examples

      USE tests VIA "DBFCDX" NEW
      SET INDEX TO tests
      ORDBAGNAME( "TeName" )        // Returns: Customer
      ORDBAGNAME( "TeLast" )        // Returns: Customer
      ORDBAGNAME( "teZip" )         // Returns: Customer
      SET ORDER TO TAG TeName
      ? OrderBagName()              // Returns: Custumer

 

Compliance

Clipper

Platforms

All

Files

Library is rdd

Seealso

INDEXORD(), ORDBAGEXT(), ALIAS()

Used()

Used()

Checks whether a database is in use in a work area

Syntax

      Used() --> lDbfOpen

Arguments

(This function has no arguments)

Returns

<lDbfOpen> True is a database is Used;otherwise False

Description

This function returns a logical true (.T.) if a database file is in USE in the current or designated work area. If no alias is specified along with this function , it will default to the currently selected work area.

Examples

      USE tests NEW
      USE names NEW
      ? Used()    // .T.
      ? TESTS->( Used() ) //.T.
      CLOSE
      ? Used()  // .F.
      SELECT tests
      ? Used() //.T.

Compliance

Clipper

Files

Library is rdd

Seealso

Alias(), Select()

Select()

Select()

Returns the work area number for a specified alias.

Syntax

      Select([<cAlias>]) --> nWorkArea

Arguments

<cAlias> is the target work area alias name.

Returns

Select() returns the work area number.

Description

This function returns the work area number for the specified alias name <cAlias>. If no parameter is specified, the current work area will be the return value of the function.

Examples

      USE tests NEW
      USE names NEW
      cOldArea := Select( "names" )
      SELECT test
      LIST
      SELECT cOldArea

Compliance

Clipper

Files

Library is rdd

Seealso

Alias(), Used()