xsharp.eu • SetOrder(0) method problem
Page 1 of 1

SetOrder(0) method problem

Posted: Mon Jul 15, 2024 6:39 am
by dododo01
Hi,

I migrated a VO application to X#.
in a class I opened a DBserver with 8 indexes.
The setOrder method works fine for all 8 indexes, but returns false when I perform a setOrder(0) sequential order.

nOrder := oControl:Value
IF !SELF:Server:setorder(nOrder)
Message("E", "", "Unable to select "+vOrder)
RETURN
ENDIF

Has anyone encountered this before?
thanks.

Re: SetOrder(0) method problem

Posted: Mon Jul 15, 2024 9:07 am
by Chris
Hi Dominique,

That should normally work. What index are you using, CDX or NTX? Is this the only dbf that doesn't work correctly, or is it with all dbfs?

Re: SetOrder(0) method problem

Posted: Mon Jul 15, 2024 9:29 am
by dododo01
Hi Chris,

I use ntx.
the problem occurs on others dbf files.

Re: SetOrder(0) method problem

Posted: Mon Jul 15, 2024 9:54 am
by Chris
Hi Dominique,

Thanks, I was testing with CDX before where it works well, but I do see the problem with NTX.

Will open a report for it to be fixed, but for now I think you can ignore the FALSE return value for SetOrder(0), it seems that the natural order is actually getting selected correctly.

Re: SetOrder(0) method problem

Posted: Wed Jul 17, 2024 1:30 pm
by Cyril
Hi Chris

I think we have some others problems with NTX index.
Zap function and Reindex function don't perform correctly.

For example the following code:

Code: Select all

	LOCAL oDB AS DbServer
	LOCAL oMes AS warningbox
	
	oDB := DBserver{"C:\Temp\testIndex\EXPLOIT_Test_Zap.DBF", FALSE, FALSE, "DBFNTX"}
	oDB:SetIndex("C:\Temp\testIndex\EXPLOIT_Test_Zap.NTX")
	
	oMes := warningbox{,"Message", "NTX : Count before Zap = " + Str(oDB:Count())}
	oMes:show()	

	oDB:Zap()
	oMes := warningbox{,"Message", "NTX : Count after Zap = " + Str(oDB:Count())}
	oMes:show()	                                     
	
	oDB:Append()
	oDB:FIELDPUT(#CLEF, "GX003")
	oDB:FIELDPUT(#CHEMIN_exe,"Test")
	oMes := warningbox{,"Message", "NTX : Count after Append = " + Str(oDB:Count())}
	oMes:show()
	
	oDB:Reindex()
	oMes := warningbox{,"Message", "NTX : Count after Reindex = " + Str(oDB:Count())}
	oMes:show()
	
	oDB:CreateIndex("C:\Temp\testIndex\EXPLOIT_Test_Zap.NTX", "substr(clef,3,3)")
	oMes := warningbox{,"Message", "NTX : Count after CreateIndex = " + Str(oDB:Count())}
	oMes:show()
	
	oDB:Close()

	oDB := DBserver{"C:\Temp\testIndex\EXPLOIT_Test_Zap.DBF", FALSE, FALSE, "DBFCDX"}
	oDB:SetIndex("C:\Temp\testIndex\EXPLOIT_Test_Zap.CDX")
	
	oMes := warningbox{,"Message", "CDX : Count before Zap = " + Str(oDB:Count())}
	oMes:show()	

	oDB:Zap()
	oMes := warningbox{,"Message", "CDX : Count after Zap = " + Str(oDB:Count())}
	oMes:show()	                                     
	
	oDB:Append()
	oDB:FIELDPUT(#CLEF, "GX003")
	oDB:FIELDPUT(#CHEMIN_exe,"Test")
	oMes := warningbox{,"Message", "CDX : Count after Append = " + Str(oDB:Count())}
	oMes:show()
	
	oDB:Reindex()
	oMes := warningbox{,"Message", "CDX : Count after Reindex = " + Str(oDB:Count())}
	oMes:show()
	
	oDB:CreateIndex("C:\Temp\testIndex\EXPLOIT_Test_Zap.CDX", "substr(clef,3,3)")
	oMes := warningbox{,"Message", "CDX : Count after CreateIndex = " + Str(oDB:Count())}
	oMes:show()
	
	oDB:Close()

Is it possible to fix this 2 issues and have you a method to convert simply NTX DBF to CDX DBF ?

Thank you
Cyril

Re: SetOrder(0) method problem

Posted: Wed Jul 17, 2024 1:38 pm
by Chris
Hi Cyril,

The Zap problem was reported again some days ago and is already fixed, the fix will be included in the next X# release.
We were not aware of a problem with Reindex though, does this only happen after the Zap? If yes, then probably the Zap fix takes care of that, too.

Re: SetOrder(0) method problem

Posted: Wed Jul 17, 2024 1:42 pm
by Cyril
Thank you Chris

Yes Reindex problem append after zap. I'll test with the next release

Cyril