-
-
Notifications
You must be signed in to change notification settings - Fork 45
Closed
Description
This sample switches to the descend view before it tries to set a OrderScope
Note: the sample uses instead of
OrdScope(TOPSCOPE, "R")
OrdScope(BOTTOMSCOPE, "B")
the wrong order:
OrdScope(TOPSCOPE, "B") // Note: must be "R" !
OrdScope(BOTTOMSCOPE, "R") // Note: must be "B" !
ordKeycount() returns correctly 0
but Eof() returns .f. instead of .t.
but Bof() returns .f. instead of .t.
FUNCTION OrdDescAndOrdScope() AS VOID
LOCAL cDBF, cPfad, cIndex AS STRING
LOCAL aFields, aValues AS ARRAY
LOCAL i AS DWORD
RddSetDefault ( "DBFCDX" )
cPfad := "D:\test\"
cDBF := cPfad + "Foo"
cIndex := cPfad + "Foox"
FErase ( cIndex + IndexExt() )
aFields := { { "LAST" , "C" , 20 , 0 } }
aValues := { "g6" , "o2", "g2" , "g1" , "g3" , "g5" , "B1" , "b2" , "p", "q" , "r" , "s" }
// ------------
DbCreate( cDBF , AFields)
DbUseArea( ,,cDBF )
FOR i := 1 UPTO ALen ( aValues )
DbAppend()
FieldPut ( 1 , aValues [ i ] )
NEXT
DbCreateOrder ( "ORDER1" , cIndex , "upper(LAST)" , { || Upper ( _Field->LAST) } )
DbCloseArea()
// --------------
DbUseArea( ,,cDBF )
DbSetIndex ( cIndex )
DbSetOrder ( 1 )
OrdDescend ( , , TRUE ) // switch to descend view
OrdScope(TOPSCOPE, "B") // Note: must be "R" !
OrdScope(BOTTOMSCOPE, "R") // Note: must be "B" !
? "OrdKeyCount()" , OrdKeyCount()
?
// -------------
DbGoTop()
? Bof() , Eof() // both return .f. !
DO WHILE ! Eof()
? FieldGet ( 1 )
DbSkip ( 1 )
ENDDO
DbGoTop()
? Bof() , Eof() // both return .f. !
DbGoBottom()
? Bof() , Eof() // both return .f. !
DbCloseArea()
RETURN
regards
Karl-Heinz