Bug in Harbour Descend()
- karinha
- Posts: 7932
- Joined: Tue Dec 20, 2005 7:36 pm
- Location: São Paulo - Brasil
- Been thanked: 3 times
- Contact:
Re: Bug in Harbour Descend()
Master Enrico, look this:
http://www.pctoledo.com.br/forum/viewtopic.php?f=4&t=19895
Regards, saludos.
http://www.pctoledo.com.br/forum/viewtopic.php?f=4&t=19895
Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
- Enrico Maria Giordano
- Posts: 8753
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Has thanked: 1 time
- Been thanked: 3 times
- Contact:
Re: Bug in Harbour Descend()
Ok, thank you. I already use that workaround. I was hope that there is a better way.
- Enrico Maria Giordano
- Posts: 8753
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Has thanked: 1 time
- Been thanked: 3 times
- Contact:
Re: Bug in Harbour Descend()
Please note that this is not working too:
I can't believe that this bug has not been corrected yet...![Sad :-(](./images/smilies/icon_sad.gif)
Code: Select all | Expand
DESCEND( DTOS( dDate ) )
I can't believe that this bug has not been corrected yet...
![Sad :-(](./images/smilies/icon_sad.gif)
- karinha
- Posts: 7932
- Joined: Tue Dec 20, 2005 7:36 pm
- Location: São Paulo - Brasil
- Been thanked: 3 times
- Contact:
Re: Bug in Harbour Descend()
Master Enrico, I'm not sure, but I think you have to save the DATES, in a Database first. Just an idea.
Maestro Enrico, no estoy seguro, pero creo que primero debe guardar las FECHAS en una base de datos. Solo una idea.
Example / ejemplo:
Regards, saludos.
Maestro Enrico, no estoy seguro, pero creo que primero debe guardar las FECHAS en una base de datos. Solo una idea.
Example / ejemplo:
Code: Select all | Expand
USE Sales NEW
INDEX ON Str(Descend(SaleDate)) + Salesman TO LastSale
OR
USE Sales NEW
INDEX ON Descend(OrdDate) TO SalesDate
Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
- Enrico Maria Giordano
- Posts: 8753
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Has thanked: 1 time
- Been thanked: 3 times
- Contact:
Re: Bug in Harbour Descend()
It doesn't work either. This works:
But this not:
Please note that there is no problem at all with xHarbour.
Code: Select all | Expand
DESCEND( dDate )
But this not:
Code: Select all | Expand
DESCEND( DTOS( dDate ) )
Please note that there is no problem at all with xHarbour.
- karinha
- Posts: 7932
- Joined: Tue Dec 20, 2005 7:36 pm
- Location: São Paulo - Brasil
- Been thanked: 3 times
- Contact:
Re: Bug in Harbour Descend()
? DESCEND( dDate ) // Esto me retorna un numero, está correcto?
Regards, saludos.
Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
- Enrico Maria Giordano
- Posts: 8753
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Has thanked: 1 time
- Been thanked: 3 times
- Contact:
Re: Bug in Harbour Descend()
Yes, that's right. The problem is there when you want to combine dates and other data types. In this case you have to convert the dates to strings and here the codepage breaks the sort order of the descending string.
- karinha
- Posts: 7932
- Joined: Tue Dec 20, 2005 7:36 pm
- Location: São Paulo - Brasil
- Been thanked: 3 times
- Contact:
Re: Bug in Harbour Descend()
OK. Look this, please:
http://www.pctoledo.com.br/forum/viewtopic.php?f=4&t=17321&p=107630&hilit=descend
Regards, saludos.
http://www.pctoledo.com.br/forum/viewtopic.php?f=4&t=17321&p=107630&hilit=descend
Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
- Enrico Maria Giordano
- Posts: 8753
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Has thanked: 1 time
- Been thanked: 3 times
- Contact:
Re: Bug in Harbour Descend()
Thank you. It is not a real solution but better than nothing:
Let's hope that Harbour developers will fix the bug, one day or another...
My concern is that Descend() could be called millions of times during a sort. So it should be as faster as possible.
Code: Select all | Expand
DESCEND( STR( nVal ) ) => STR( 999999999999999 - nVal )
DESCEND( DTOS( dVal ) ) => STR( DESCEND( dVal ) )
Let's hope that Harbour developers will fix the bug, one day or another...
My concern is that Descend() could be called millions of times during a sort. So it should be as faster as possible.
Re: Bug in Harbour Descend()
From Harbour-users group
Dear Enrico
Please try with this. I hope you find this codepage useful
DESCEND() function is designed to operate on binary (BYTE) sorting
and gives reverted collation order only for codepages which use
such collation.
Because DESCEND() converts numbers to characters which have
special order in CP you are using. Look at this list archive
for some easy to create custom DESCEND() replacements which
can be used with non accented Latin based languages like
Lithuanian or Polish ones.
Dear Enrico
Please try with this. I hope you find this codepage useful
Code: Select all | Expand
REQUEST HB_LANG_IT
REQUEST HB_CODEPAGE_ITWIN, HB_CODEPAGE_IT850
HB_CDPSELECT( "IT850" )
hb_langSelect( 'IT' )
// hb_SetTermCP( 'ITWIN', 'ITWIN', .T. ) // Also with it run ok
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
- Enrico Maria Giordano
- Posts: 8753
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Has thanked: 1 time
- Been thanked: 3 times
- Contact:
Re: Bug in Harbour Descend()
It doesn't work, it creates a file with the wrong name. Please try this:
Code: Select all | Expand
#include "Fivewin.ch"
REQUEST HB_LANG_IT
REQUEST HB_CODEPAGE_ITWIN, HB_CODEPAGE_IT850
FUNCTION MAIN()
HB_CDPSELECT( "IT850" )
HB_LANGSELECT( "IT" )
HB_SETTERMCP( "ITWIN", "ITWIN", .T. )
MEMOWRIT( "àèéìòù.txt", "àèéìòù" )
RETURN NIL
Re: Bug in Harbour Descend()
Enrico Maria Giordano wrote:It doesn't work, it creates a file with the wrong name. Please try this:Code: Select all | Expand
#include "Fivewin.ch"
REQUEST HB_LANG_IT
REQUEST HB_CODEPAGE_ITWIN, HB_CODEPAGE_IT850
FUNCTION MAIN()
HB_CDPSELECT( "IT850" )
HB_LANGSELECT( "IT" )
HB_SETTERMCP( "ITWIN", "ITWIN", .T. )
MEMOWRIT( "àèéìòù.txt", "àèéìòù" )
RETURN NIL
Sorry Enrico, but the example you put now has nothing to do with the Descend() function
Has the example I posted worked?
I will look at the new example you propose and I will answer you
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
- Enrico Maria Giordano
- Posts: 8753
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Has thanked: 1 time
- Been thanked: 3 times
- Contact:
Re: Bug in Harbour Descend()
The problem is: without any codepage settings (ie. EN codepage) Descend() is fine but accented chars from filesystem are wrong. With ITWIN (or other codepages I tried) the accented chars from filesystem are right but Descend() is not working.
Any solutions will make me happy.![Smile :-)](./images/smilies/icon_smile.gif)
Any solutions will make me happy.
![Smile :-)](./images/smilies/icon_smile.gif)
Re: Bug in Harbour Descend()
Enrico Maria Giordano wrote:The problem is: without any codepage settings (ie. EN codepage) Descend() is fine but accented chars from filesystem are wrong. With ITWIN (or other codepages I tried) the accented chars from filesystem are right but Descend() is not working.
Any solutions will make me happy.
This is more simple
Code: Select all | Expand
#include "Fivewin.ch"
FUNCTION MAIN()
LOCAL aData[ 7 ]
LOCAL i
HB_SETCODEPAGE( "UTF8" )
aData[ 1 ] = { "TEST1", 3107.77 }
aData[ 2 ] = { "TEST2", 852.07 }
aData[ 3 ] = { "TEST3", 191.00 }
aData[ 4 ] = { "TEST4", 148.68 }
aData[ 5 ] = { "TEST5", 44.73 }
aData[ 6 ] = { "TEST6", 15.24 }
aData[ 7 ] = { "TEST7", 255.65 }
ASORT( aData, , , { | aItem1, aItem2 | Descend( Str( aItem1[ 2 ], 10, 2 ) ) + aItem1[ 1 ] < Descend( Str( aItem2[ 2 ], 10, 2 ) ) + aItem2[ 1 ] } )
xBrowse( aData )
hb_MemoWrit( "àèéìòù.txt", "àèéìòù" )
RETURN NIL
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
- Enrico Maria Giordano
- Posts: 8753
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Has thanked: 1 time
- Been thanked: 3 times
- Contact:
Re: Bug in Harbour Descend()
Sorry, it doesn't work:
Result:
![Sad :-(](./images/smilies/icon_sad.gif)
Code: Select all | Expand
? hb_MemoWrit( "àèéìòù.txt", "àèéìòù" )
Result:
Code: Select all | Expand
.F.
![Sad :-(](./images/smilies/icon_sad.gif)