xsharp.eu • Falsch sortiert
Page 1 of 1

Falsch sortiert

Posted: Thu Mar 14, 2024 4:33 pm
by Horst
Hallo

Habe ein kleines Problem. Mein Modul um CDX Files neu aufzubauen generiert in einem Fall das CDX File aber die Sortierung ist falsch.

Wen ich mit dbAdmin den Index neu aufbaue stimmt es.

Im Anhang das kleine lauffähige Muster. Hoffe alles ist drin :-)

In VO genau gleich, macht den Index aber die Sortierung stimmt nicht.

Gruss
Horst

Re: Falsch sortiert

Posted: Thu Mar 14, 2024 6:01 pm
by g.bunzel@domonet.de
Horst,

in VO habe ich diesen Vermerk:

SetAnsi( TRUE ) // after SetNatDLL()!!


Evtl. funktioniert das auch in X#.

HTH

Gerhard

Re: Falsch sortiert

Posted: Thu Mar 14, 2024 11:26 pm
by Chris
Hi Horst,

Can you please explain a bit more on what exactly is wrong with the generated sort order? It seems to be ok here, but I'm probably overlooking something.

Re: Falsch sortiert

Posted: Fri Mar 15, 2024 7:37 am
by Horst
Hallo Gerhard

Habe es probiert, keine Änderung

Hello Chris

I reduzed the code and i added a second DB to sort.

Code: Select all

  
	cPfad 				:= "c:\XIDE\TMP\"    
	
	// PV_Module
	cFilename 			:= cPfad+"PV_Module"
	FErase 				(String2Psz (cFilename+".cdx")) 

	odbTmp 				:= dbserver {cFilename,FALSE,FALSE,"DBFCDX"}   // ohne DBF
	odbTmp:createorder ("PVMODULE",,"HERSTELLER",{|| _field->HERSTELLER})

	/* ----------------------*/                         

	// Buchtexte
	cFilename 			:= cPfad+"Buchtexte"
	FErase 				(String2Psz (cFilename+".cdx")) 

	odbTmp 				:= dbserver {cFilename,FALSE,FALSE,"DBFCDX"}   // ohne DBF
	odbTmp:createorder ("Buch",,"BESCHRIEB",{|| _field->Beschrieb})
All Files are in the zip file.

Please look on the screenshot (shot2.jpg), there you can see on the left side the DB is not sorted , on the right side its sorted.
I dont know why the DB PV_Module is not sorted. I tryed also a different Field (ModulTyp->shot3.jpg) to sort but doesnt work.
When i say to dbAdmin to recreate the index , it works.

Horst

Re: Falsch sortiert

Posted: Fri Mar 15, 2024 8:30 am
by Chris
Hi Horst,

Thanks, i see the problem now, it's because the field in some of the records (those that appear on top after reindexing) have a few space characters in front of them. For example the "LG SOLAR" field is actually stored in the dbf as " LG SOLAR". If you remove those spaces from the fields, then the order is correct.

I don't know why dbAdmin does not show the spaces in front of the fields in the browser, but if you try to edit the field (from dbAdmin) then you will see them.

Re: Falsch sortiert

Posted: Fri Mar 15, 2024 9:03 am
by Horst
Hello Chris

Thank you very mutch, i see it now, its a TAB.

Horst