LastRec()

LASTREC()

Returns the number of records in an active work area or database.

Syntax

      LASTREC() | RECCOUNT()* --> nRecords

Returns

<nRecords > The number of records

Description

This function returns the number of records present in the database in the selected or designated work area. If no records are present the value of this function will be 0. Additionaly, if no database is in use in the selected or designated work area, this function will return a 0 value as well.

Examples

      USE tests NEW
      ? LASTREC(), RECCOUNT()

Compliance

Clipper

Platforms

All

Files

Library is rdd

Seealso

EOF()

Header()

HEADER()

Return the length of a database file header

Syntax

      HEADER() --> nBytes

Returns

<nBytes> The numeric size of a database file header in bytes

Description

This function returns the number of bytes in the header of the selected database ot the database in the designated work area.

If used in conjunction with the LASTREC(), RECSIZE() and DISKSPACE() functions, this functions is capable of implementing a backup and restore routine.

Examples

      USE tests NEW
      ? Header()

Compliance

Clipper

Files

Library is rdd

Seealso

DISKSPACE(), LASTREC(), RECSIZE()

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()

FLock()

FLOCK()

Locks a file

Syntax

      FLOCK() --> lSuccess

Returns

<lSuccess> A true (.T.) value, if the lock was successful;otherwise false (.F.)

Description

This function returns a logical true (.T.) if a file lock is attempted and is successfully placed on the current or designated database. This function will also unlock all records locks placed by the same network station.

Examples

      USE tests New
      IF FLOCK()
         SUM tests->Ammount
      ENDIF
      USE

Compliance

Clipper

Files

Library is rdd

Seealso

RLOCK()

FieldPut()

FIELDPUT()

Set the value of a field variable

Syntax

      FIELDPUT(<nField>, <expAssign>) --> ValueAssigned

Arguments

<nField> The field numeric position

<expAssign> Expression to be assigned to the specified field

Returns

<ValueAssigned> Any expression

Description

This function assings the value in <expAssing> to the <nField>th field in the current or designated work area. If the operation is successful, the return value of the function will be the same value assigned to the specified field. If the operation is not successful, the function will return a NIL data type

Examples

      USE tests NEW
      FIELDPUT( 1, "Mr. Jones" )
      USE

Compliance

Clipper

Files

Library is rdd

Seealso

FIELDGET()

FieldPos()

FIELDPOS()

Return the ordinal position of a field.

Syntax

      FIELDPOS(<cFieldName>) --> nFieldPos

Arguments

<cFieldName> Name of a field.

Returns

<nFieldPos> is ordinal position of the field.

Description

This function return the ordinal position of the specified field <cField> in the current or aliased work areaIf there isn’t field under the name of <cField> or of no database is open in the selected work area, the func- tion will return a 0.

Examples

      PROCEDURE Main()
         USE test NEW
         ? test->( FIELDPOS( "ID" ) )
         USE
         RETURN

Compliance

Clipper

Files

Library is rdd

Seealso

FIELDGET(), FIELDPUT()

FieldName()

FIELDNAME()

Return the name of a field at a numeric field location.

Syntax

      FIELDNAME/FIELD(<nPosition>) --> cFieldName

Arguments

<nPosition> Field order in the database.

Returns

<cFieldName> returns the field name.

Description

This function return the name of the field at the <nPosition>th position. If the numeric value passed to this function does not correspond to an existing field in the designated or selected work area, this function will return a NULL byte.

Examples

      PROCEDURE Main()
         LOCAL x
         USE tests NEW
         FOR x := 1 TO tests->( FCOUNT() )
            ? "Field Name", FieldName( x )
         NEXT
         USE
         RETURN

Compliance

Clipper

Files

Library is rdd

Seealso

DBSTRUCT(), FCOUNT(), LEN(), VALTYPE()

FieldGet()

FIELDGET()

Obtains the value of a specified field

Syntax

      FIELDGET(<nField>) --> ValueField

Arguments

<nField> Is the numeric field position

Returns

<ValueField> Any expression

Description

This function returns the value of the field at the <nField>th location in the selected or designed work area. If the value in <nField> does not correspond to n avaliable field position in this work area, the function will return a NIL data type.

Examples

      PROCEDURE Main()
         USE test NEW
         ? test->( FieldGet( 1 ) )
         USE
         RETURN

Compliance

Clipper

Files

Library is rdd

Seealso

FIELDPUT()

FCount()

FCOUNT()

Counts the number of fields in an active database.

Syntax

      FCOUNT() --> nFields

Returns

<nFields> Return the number of fields

Description

This function returns the number of fields in the current or designated work area. If no database is open in this work area, the function will return 0.

Examples

      PROCEDURE Main()
         USE tests NEW
         ? "This database have", tests->( FCOUNT() ), "Fields"
         USE
         RETURN

Compliance

Clipper

Files

Library is rdd

Seealso

FIELDNAME(), TYPE()

Eof()

EOF()

Test for end-of-file condition.

Syntax

      EOF() --> <lEnd>

Arguments

(This command has no arguments)

Returns

<lEnd> A logical true (.T.) or false (.F.)

Description

This function determines if the end-of-file marker has been reached. If it has, the function will return a logical true (.T.); otherwise a logical false (.F.) will be returnd

Examples

      PROCEDURE Main()
         USE tests NEW
         DBGOTOP()
         ? "Is Eof()", EOF()
         DBGOBOTTOM()
         ? "Is Eof()", EOF()
         USE
         RETURN

Compliance

Clipper

Files

Library is rdd

Seealso

BOF(), FOUND(), LASTREC()