Click or drag to resize

Descending Function

X#
Returns a logical value that indicates whether an index tag was created with the Descending keyword or whether the Descending keyword was included in Use, Set Index, or Set Order.

Namespace:  XSharp.VFP
Assembly:  XSharp.VFP (in XSharp.VFP.dll) Version: 2.19
Syntax
 FUNCTION Descending(
	uIndex,
	uArea
) AS USUAL CLIPPER
Request Example View Source

Parameters

uIndex (Optional)
Type: Usual
Specifies the name or index number of a compound index file with CDXFileName. The compound index file you specify can be the structural compound index file automatically opened with the table or an independent compound index file.
Specifies which index tag or index file Descending( ) tests. nIndexNumber is typically an integer that starts at 1 and is increased by 1 to return additional values for each index tag.
If nIndexNumber is 1, a value for the master single-entry .idx index file or master index tag (if one is present) is returned.
As nIndexNumber increases, values for each tag in the structural compound index (if one is present) are returned.
The values are returned for the tags in the order in which the tags were created in the structural compound index. After values for all the tags in the structural compound index are returned, values for each tag in any open independent compound indexes are then returned. The values are returned from the tags in the order in which the tags are created in the independent compound indexes.
The empty string is returned if nIndexNumber is greater than the total number of open, single-entry .idx files and structural compound and independent compound index tags.
uArea (Optional)
Type: Usual
Returns values for index files or tags open in a work area other than the current work area. This specifies the work area number or table alias.
If no table has the alias you specify, X# generates an error message.

Return Value

Type: Usual
Logical
Remarks
You can order records in a table in descending order in two ways:
    Descending( ) can determine if an index tag was created in descending order. Descending( ) returns true (.T.) if the index tag you specify was created with the Descending keyword.
    Descending( ) can also determine if the master index tag or master index file is in descending order. Descending( ) returns true (.T.) if the Descending keyword was included in Use, Set Index, or Set Order for the master index tag or a single-entry index (.idx) file you specify.
    If you don't include any of the optional arguments, Descending( ) returns a value for the master index tag or master index file. If you don't include any of the optional arguments and a master index tag or .idx file isn't in effect (for example, you've issued Set Order TO to place the table in physical record order), Descending( ) returns false (.F.).
Examples
X#
 1Close Databases
 2Open Database (HOME(2) + 'Data\testdata')
 3Use Customer     // Open customer table
 4Clear
 5For nCount = 1 TO TAGCOUNT( )
 6IF !EMPTY(TAG(nCount))  // Checks for tags in the index
 7? TAG(nCount) + ' Descending? ' // Display tag name
 8?? Descending(nCount)  // Display descending status
 9ELSE
10EXIT  // Exit the loop when no more tags are found
11ENDIF
12ENDFor
See Also