ÍNDICE o INDICE

HMG en Español

Moderator: Rathinagiri

User avatar
Algernon
Posts: 55
Joined: Sat Mar 20, 2010 10:36 am
DBs Used: DBF
Location: Arucas, Gran Canaria, Canary Islands

ÍNDICE o INDICE

Post by Algernon »

Cuando indexamos una base de datos por un campo alfabético el índice será en la secuencia {a,A, b,B,c,C,d,D,e,E,……… á,Á,é,É,……..}, tengo un problema ya que en castellano las vocales que llevan tilde, se ordenan en dicha secuencia. Por ejemplo en una base de datos de clientes tengo un campo que se llama CAPELLNOM y es alfabético y contiene los (apellidos, nombre) de los clientes. Cuando abro la base de datos con el índice de dicho campo obtengo lo siguiente:
Pantalla de la tabla indexada
Pantalla de la tabla indexada
indice.jpg (106.3 KiB) Viewed 6582 times
Verán que ÁLAMO SANTANA, JUAN va al final de la tabla y en realidad con una ordenación alfabética española sería el primer registro de la tabla, o el cliente SÁNCHEZ LIRIA, JOSÉ CARLOS debería ir antes de SANTANA JIMÉNEZ, LUCAS. Al igual ocurre con la letra Ñ que no se ordena como el alfabeto español.

Hay alguien que ha tenido este problema. ¿Cómo lo ha solucionado?, ¿Habría que evitar poner las tildes?, ¿Haría falta algún comando SET LANGUAGE o algo por el estilo?

Gracias de antemano.

PD: Lo pongo en este apartado de Español, aunque hay otros idiomas que llevan letras con símbolos como ö, â, å, æ, é, è, ô, etc.

Javier Suárez

La obra humana más bella es la de ser útil al prójimo. (Sófocles)
The most beautiful work of man is to be useful to others. (Sófocles)
User avatar
Vanguarda
Posts: 543
Joined: Wed Feb 11, 2009 10:56 am
Location: Americana - SP
Contact:

Re: ÍNDICE o INDICE

Post by Vanguarda »

Hi friend,

Please, see this topic bellow.

viewtopic.php?p=9180#p9180


I hope that help.

My best regards,
--
Paulo Sérgio Durço (Vanguarda)


http://hmglights.wordpress.com/
User avatar
Vanguarda
Posts: 543
Joined: Wed Feb 11, 2009 10:56 am
Location: Americana - SP
Contact:

Re: ÍNDICE o INDICE

Post by Vanguarda »

Try it on you main function.

Code: Select all

REQUEST HB_CODEPAGE_ES850
HB_SETCODEPAGE( “ES850″ ) 
I think it work.


PS: I think that you must reindex your table again.

My best regards,
--
Paulo Sérgio Durço (Vanguarda)


http://hmglights.wordpress.com/
User avatar
Algernon
Posts: 55
Joined: Sat Mar 20, 2010 10:36 am
DBs Used: DBF
Location: Arucas, Gran Canaria, Canary Islands

Re: ÍNDICE o INDICE

Post by Algernon »

Thanks Vanguarda

I've tryed first this:

Code: Select all

REQUEST HB_CODEPAGE_ES850
HB_SETCODEPAGE( “ES850″ ) 
and nothing happens, the secuence was the same

Then I tryed this:

Code: Select all

REQUEST HB_CODEPAGE_ESWIN
HB_SETCODEPAGE( “ESWIN″ )

and

REQUEST HB_CODEPAGE_ESMWIN
HB_SETCODEPAGE( “ESMWIN″ )  
with both all was fine, except with the words that start with Á or É, but the others is ok example SÁNCHEZ or any word with Ñ.

Now with this all the words with SÁ came before all the words that start with SA.

Thanks soon for your replay Vanguard.

Javier Suárez

La obra humana más bella es la de ser útil al prójimo. (Sófocles)
The most beautiful work of man is to be useful to others. (Sófocles)
User avatar
esgici
Posts: 4543
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Contact:

Re: ÍNDICE o INDICE

Post by esgici »

Algernon wrote:Cuando indexamos una base de datos por un campo alfabético el índice será en la secuencia {a,A, b,B,c,C,d,D,e,E,……… á,Á,é,É,……..}, tengo un problema ya que en castellano las vocales que llevan tilde, se ordenan en dicha secuencia.
Google Translator wrote:When you index a database field will be alphabetical index in the sequence (a, A, B, B, C, C, D, D, E, E, ... ... ... á, Á, é, É, ... ... ..), I have a problem because the vowels in Castilian accents, are arranged in that sequence. For example in a customer database I have a field called CAPELLNOM and is alphabetical and contains the (surname, name) customers. When I open the database with the index of that field I get the following:
Hola Algernon

First thanks to you are using DBA, when I have seen your example jpg, I have seen an old friend :)

Regarding your problem, could you send me a string consist on your correctly sequenced letters. F.e : aáAÁbBcCdDeéEÉ ... or ( IMHO more preferable) AÁaáBbCcDdEÉeé...

Saludos, regards

--

Esgici
Viva INTERNATIONAL HMG :D
User avatar
Algernon
Posts: 55
Joined: Sat Mar 20, 2010 10:36 am
DBs Used: DBF
Location: Arucas, Gran Canaria, Canary Islands

Re: ÍNDICE o INDICE

Post by Algernon »

Hi Esgici,

I've just learning HMG, as I said in my introduce I used Clipper Summer 87' and now I've been remenbering things, by the moment I don´t remenber how I used to index in this sequenced, I would like this index sequence:

{AÁaáBbCcDdEÉeéFfGgHhIíJjKkLlMmNnÑñOoPpQqRrSsTtUuVvWwXxYyZz}

I'm using DBA because it makes what I need. I've tried others but this has be the best for my use.

Saludos, regards and Thanks very much to all the members of this wonderful Forum.

Sorry if my english is not too good. I hope you understand me.

Javier Suárez

La obra humana más bella es la de ser útil al prójimo. (Sófocles)
The most beautiful work of man is to be useful to others. (Sófocles)
User avatar
esgici
Posts: 4543
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Contact:

Re: ÍNDICE o INDICE

Post by esgici »

Algernon wrote: I've just learning HMG, as I said in my introduce I used Clipper Summer 87' and now I've been remenbering things, by the moment I don´t remenber how I used to index in this sequenced, I would like this index sequence:

{AÁaáBbCcDdEÉeéFfGgHhIíJjKkLlMmNnÑñOoPpQqRrSsTtUuVvWwXxYyZz}

I'm using DBA because it makes what I need. I've tried others but this has be the best for my use.

Saludos, regards and Thanks very much to all the members of this wonderful Forum.

Sorry if my english is not too good. I hope you understand me.
Hi Algernon

First, welcome aboard, saludos from Turkey :)

Then, thanks to your nice words about DBA :)

Well, my language too include accented characters and in computer everything likes for Ingles ! All non-english character come after "z" ! Damn !

Fortunately (many thanks to builders of Clipper), dBase indexes have opportunity of based (none only field content), any valid expression, including a return value of a function :D

So we can use a function for product correct value for correct indexing.

Code: Select all

#define cEspCharSet "AÁaáBbCcDdEÉeéFfGgHhIíJjKkLlMmNnÑñOoPpQqRrSsTtUuVvWwXxYyZz"

******
*
* EspAColSeq    : Español Alternate Collating Sequence
*
FUNC EspAColSeq(  cInStr  )                       // Español Alternate Collating Sequence
   LOCA cOutStr   := "",;
            nCounter :=  0,;
            nChrPtr   :=  0

   FOR  nCounter  := 1 TO LEN( cInStr )
      nChrPtr := AT( SUBS( cInStr, nCounter, 1), cEspCharSet )
      cOutStr := cOutStr + IF( bChrPtr == 0, SUBS( cInStr, nCounter , 1 ), CHR( 63 + nChrPtr ) )
   NEXT

   RETU cOutStr // EspAColSeq()
   
*_.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.
That is all !

For indexing use this function for make index key, such as :

Code: Select all

INDEX ON EspAColSeq( <cKeyExpression> ) TO ...
For SEEK, FIND commands also use this function :

Code: Select all

SEEK EspAColSeq( <cSeekString> )
Up to here was good news, bad news are :

- Since I haven't any Español data, I couldn't test function. Please warn me for any problem

- You must use everywhere this function for using that .dbf associated with that index file. For example, with DBA you can't use that index, because DBA don't know EspAColSeq() function. Not only for random access (SEEK, FIND), sequential access too require this.

I hope that help you (and other Español speaking friends) :D

Of course, by changing value of cEspCharSet string, this function may use for any language.

Please don't worry about English; believe me your English is better than mine :)

Saludos, regards

--

Esgici
Last edited by esgici on Thu Nov 10, 2011 10:32 pm, edited 1 time in total.
Viva INTERNATIONAL HMG :D
User avatar
Vanguarda
Posts: 543
Joined: Wed Feb 11, 2009 10:56 am
Location: Americana - SP
Contact:

Re: ÍNDICE o INDICE

Post by Vanguarda »

WOW very nice friend Esgici.

Regards,
--
Paulo Sérgio Durço (Vanguarda)


http://hmglights.wordpress.com/
User avatar
esgici
Posts: 4543
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Contact:

Re: ÍNDICE o INDICE

Post by esgici »

Thanks Paulo

Saludos cordiales

--

Esgici
Viva INTERNATIONAL HMG :D
Post Reply