Click or drag to resize

Functions.OrdSkipUnique Method

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.18
 FUNCTION OrdSkipUnique(
Request Example View Source


nDirection (Optional)
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.
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
This examples uses OrdSkipUnique() to build an array of unique last names beginning with the letter "J:"
 1FUNCTION LastUnique()
 2    LOCAL aLast[0]
 3    SET INDEX TO last            // Use the last name order
 4    ? OrdIsUnique()            // Result: FALSE
 5    SET SCOPE TO "J"            // Only look at the J's
 6    GO TOP
 7    DO WHILE !EOF()            // Add all the unique J
 8        AADD(aLast, Last)        // last names to aLast
 9        OrdSkipUnique()
10    ENDDO
11    SET SCOPE TO            // Clear the scope
12    RETURN aLast            // Return array of
13                        // unique J names
See Also