Click or drag to resize

OrdSkipUnique Function

Move the record pointer to the next or previous unique key in the controlling order.

Namespace:  XSharp.RT
Assembly:  XSharp.RT (in XSharp.RT.dll) Version: 2.10
Syntax
 FUNCTION OrdSkipUnique(
	 nDirection AS USUAL
) AS USUAL
View Source

Parameters

nDirection
Type: Usual
Specifies whether the function will skip to the next or previous key.  Omitting this value or specifying it as 1 skips to the next unique key.  Specifying a negative value skips to the previous key.

Return Value

Type: Usual
TRUE if successful; otherwise, FALSE.
Remarks
OrdSkipUnique() allows you to make a non-unique order look like a unique order.  Each time you use OrdSkipUnique(), you are moved to the next (or previous) unique key, exactly as if you were skipping through a unique order.  This function eliminates the problems associated with maintaining a unique order, while providing you with fast access to unique keys. By default, this function operates on the currently selected work area.  It can be made to operate on an unselected work area by specifying it within an aliased expression
Examples
This examples uses OrdSkipUnique() to build an array of unique last names beginning with the letter "J:"
X#
FUNCTION LastUnique()
        LOCAL aLast[0]
        SET INDEX TO last                        // Use the last name order
        ? OrdIsUnique()                        // Result: FALSE
        SET SCOPE TO "J"                        // Only look at the J's
        GO TOP
        DO WHILE !EOF()                        // Add all the unique J
                AADD(aLast, Last)                // last names to aLast
                OrdSkipUnique()
        ENDDO
        SET SCOPE TO                        // Clear the scope
        RETURN aLast                        // Return array of
                                                // unique J names
See Also