Ich stosse gerade auf ein seltsames Problem. Wenn ich als Suchkriterium (cSuchKz) "A verwende, bekomme ich als Ergebnis (LEN(aNames)) 1812 Datensätze bei insgesamt 2318 Datensätzen. Wenn ich "B" verwende, bekomme ich die richtige Anzahl vom 2318 Datensätzen. Wenn ich bei "A" nach Öffnen der Tabelle statt "M1->(DBSETORDER(2))" den Index manuell setze -> "SET INDEX TO vmnrnum" bekomme ich auch die richtige Anzahl.
Die Indexe einer Tabelle öffne ich normalerweise alle in einer Funktion "FUNCTION NET_USE4(file, ex_use, wait, new, al)".
Hat da jemand eine Ahnung an was das liegen könnte?
Code: Alles auswählen
IF !net_use4("MITGLIED",.F.,1,"Y","M1")
MsgBox("SUCH_DIALOG() -> MITGLIEDERTABELLE GESPERRT")
PostAppEvent( xbeP_Close, , , oDlg )
RETURN( NIL )
ENDIF
SET DELETED ON
DO CASE
CASE cSuchkz == "A"
M1->(DBSETORDER(1)) // INDEX ON UPPER(name+vorname) TO vmnavoor // Index Name
CASE cSuchkz == "B"
M1->(DBSETORDER(2)) // INDEX ON val(mitglnr) TO vmnrnum // Index VAL(Mitglnr)
ENDCASE
DO WHILE ! EOF()
AADD(aNames,"X")
DBSKIP()
ENDDO
M1->(DBCLOSEAREA())
MSgBox("LEN(aNames): "+ALLTRIm(STR(LEN(aNames))) )
FUNCTION NET_USE4(file, ex_use, wait, new, al)
PRIVATE forever
// Mit parameter ob new oder nicht, Alle Indexe werden default geöffnet
forever = (wait = 0)
DO WHILE (forever .OR. wait > 0)
IF ex_use
USE &file alias &al EXCLUSIVE new
ELSE
USE &file alias &al SHARED new
ENDIF
IF .NOT. NETERR()
// Indexe öffnen
DO CASE
CASE file = "mitglied" .OR. file = "MITGLIED"
SET INDEX TO vmnavoor, vmnrnum, vmnrnavo, vmornavo, mitglnr, vmmitstr
OTHERWISE
*MSgBox("Kein Index für Tabelle "+file+" geöffnet")
ENDCASE
RETURN (.T.)
ENDIF
INKEY(1)
wait = wait - 1
ENDDO
DBCLOSEALL()
RETURN (.F.)
// End - NET_USE4()