Descend and deleted record

This forum is meant for questions and discussions about the X# language and tools
User avatar
Horst
Posts: 336
Joined: Tue Oct 13, 2015 3:27 pm

Descend and deleted record

Post 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
Attachments
tmp.zip
(243.75 KiB) Downloaded 98 times
FFF
Posts: 1580
Joined: Fri Sep 25, 2015 4:52 pm
Location: Germany

Descend and deleted record

Post by FFF »

Horst,
you missed some parts - swisscode, QRReader and Excel.dll...
Regards
Karl
(on Win8.1/64, Xide32 2.20, X#2.20.0.3)
User avatar
Horst
Posts: 336
Joined: Tue Oct 13, 2015 3:27 pm

Descend and deleted record

Post 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
User avatar
Horst
Posts: 336
Joined: Tue Oct 13, 2015 3:27 pm

Descend and deleted record

Post by Horst »

Hello Karl

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

Sorry
User avatar
Horst
Posts: 336
Joined: Tue Oct 13, 2015 3:27 pm

Descend and deleted record

Post by Horst »

So, now with the missing dll's
Attachments
tmp.zip
(504.2 KiB) Downloaded 94 times
FFF
Posts: 1580
Joined: Fri Sep 25, 2015 4:52 pm
Location: Germany

Descend and deleted record

Post 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.
Regards
Karl
(on Win8.1/64, Xide32 2.20, X#2.20.0.3)
Karl-Heinz
Posts: 774
Joined: Wed May 17, 2017 8:50 am
Location: Germany

Descend and deleted record

Post 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 

User avatar
Chris
Posts: 4907
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

Descend and deleted record

Post 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 ()
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
FFF
Posts: 1580
Joined: Fri Sep 25, 2015 4:52 pm
Location: Germany

Descend and deleted record

Post by FFF »

Chris,
i get False, and true without the descend.
Regards
Karl
(on Win8.1/64, Xide32 2.20, X#2.20.0.3)
User avatar
Chris
Posts: 4907
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

Descend and deleted record

Post by Chris »

Hi Karl,

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

XSharp Development Team
chris(at)xsharp.eu
Post Reply