xsharp.eu • Descend and deleted record
Page 1 of 2

Descend and deleted record

Posted: Fri Mar 04, 2022 3:49 pm
by Horst
Hello

In one of my funktion i turn the index (descend) and now i found out , a seek doesnt find records when one is deleted.
Record 4669 is deleted but then comes 4 others . index expression is Id_Car+DatumC
Recall the deleted record and it finds the records.

Database and test program in the attachement.

Horst

Descend and deleted record

Posted: Fri Mar 04, 2022 4:01 pm
by FFF
Horst,
you missed some parts - swisscode, QRReader and Excel.dll...

Descend and deleted record

Posted: Fri Mar 04, 2022 4:01 pm
by Horst
Add

if i recall the deleted record (he is the first in the list) and i delete the second one it works normal

Descend and deleted record

Posted: Fri Mar 04, 2022 4:04 pm
by Horst
Hello Karl

Its the last function SuchDescend () in the start.prg the rest u can delete

Sorry

Descend and deleted record

Posted: Fri Mar 04, 2022 4:15 pm
by Horst
So, now with the missing dll's

Descend and deleted record

Posted: Fri Mar 04, 2022 4:15 pm
by FFF
OK. After removing the references, using statements, and most of the code ;) - i can confirm, that it doesn't find the record with Descend, but finds it with normal sorting.

Checked with the latest version of 2.11.

Descend and deleted record

Posted: Fri Mar 04, 2022 5:40 pm
by Karl-Heinz
HI Horst,

i seems the problem is that your first "002100000001636" record is marked as deleted. The results of my code below are:

setDeleted(false) --> car is found
setdeleted(true) --> car is not found

when you change in your code the setdeleted() setting from true to false do you see the same behaviour ?

btw. i´m using the Fox build 2.11.0.0

regards
Karl-Heinz

Code: Select all

FUNCTION TestDescend2()	AS VOID
LOCAL odb			AS DBServer 
LOCAL cDBF, cPfad, cIndex AS STRING
    
	RddSetDefault ( "DBFCDX" )
	RddInfo ( _SET_AUTOOPEN , FALSE )

	cPfad := "D:TEST"  
	cDBF := cPfad + "Arbeiten.dbf"
	cIndex := cPfad + "Arbeiten.cdx"		
	
	odb := DBServer { cDBF } // ,TRUE,FALSE,"DBFCDX"}
	? odb:SetIndex (cIndex)  
	? odb:SetOrder (1)
	odb:orderDescend ( , , TRUE)

	? 	
	? "descend search with SetDeleted(true)"
	
	SetDeleted ( TRUE ) 

	IF odb:Seek ("002100000001636")
		? "Car in Arbeiten gefunden:" //+cId_Car
	ELSE
		? "Car in Arbeiten NICHT gefunden:" //+cId_Car
	ENDIF

	? 	
	? "descend search with SetDeleted(false)"
	SetDeleted ( FALSE ) 

	IF odb:Seek ("002100000001636")
		? "Car in Arbeiten gefunden:" //+cId_Car
	ELSE
		? "Car in Arbeiten NICHT gefunden:" //+cId_Car
	ENDIF
	
	
	oDB:Close() 
	
	RETURN 


Descend and deleted record

Posted: Fri Mar 04, 2022 5:49 pm
by Chris
Horst,

I can't seem to be able to reproduce the problem. This means that either the problem is already fixed now in our current build, or I have
deleted too much code when trying to make the sample compile :)

Just to be sure we are on the same page, guys does the following code print false in your machines? (it prints true here):

Code: Select all

FUNCTION Start( ) AS VOID
	SetAnsi          	(TRUE)
	SetExclusive    	(FALSE)
	SetDeleted       	(TRUE)
	SetCollation     	(#CLIPPER)
	SetInternational 	(#CLIPPER)
	
	SetDateCountry   	(German)
	SetCentury       	(TRUE)
	SetDeleted			(TRUE)

	SetDecimalSep   (Asc ("."))
	SetThousandSep  (Asc ("'"))
	RddSetDefault 	("DBFCDX")
	SetNatDLL 		("German.dll")

	LOCAL odb			AS DBServer

	odb := DBServer {"C:...Arbeiten.dbf",TRUE,FALSE,"DBFCDX"}

	odb:SetOrder (1)
	odb:orderDescend ( , , TRUE)

	? odb:Seek ("002100000001636")
	
	DbCloseAll ()

Descend and deleted record

Posted: Fri Mar 04, 2022 5:54 pm
by FFF
Chris,
i get False, and true without the descend.

Descend and deleted record

Posted: Fri Mar 04, 2022 5:58 pm
by Chris
Hi Karl,

Thanks! Can you please also try with today's beta build? Or are you already using that?