Alaska Software Inc. - Bug with descend (again)
Username: Password:
AuthorTopic: Bug with descend (again)
Christian Laborde Bug with descend (again)
on Tue, 02 Oct 2007 17:16:55 +0200
I have always problem with descend in index. I test and find 
this strange behaviour :

descend("2007",.T.) -> "╬ðð╔"

descend("2002",.T.) -> "╬ðð╬"

descend("2002",.T.) = descend("2007",.T.) -> .T.

Why ?!?

So when I seek year 2007, I receive record for year 2002

Regards
Edgar Borger Re: Bug with descend (again)
on Tue, 02 Oct 2007 12:27:21 -0300
Christian,
I know it's frustrating, but I replaced my descend calls with 
"str(99999999 - val(dtos(datefield)),8)" or something like that !!!

regards,
Edgar


Christian Laborde escreveu:
> I have always problem with descend in index. I test and find this 
> strange behaviour :
> 
> descend("2007",.T.) -> "╬ðð╔"
> 
> descend("2002",.T.) -> "╬ðð╬"
> 
> descend("2002",.T.) = descend("2007",.T.) -> .T.
> 
> Why ?!?
> 
> So when I seek year 2007, I receive record for year 2002
> 
> Regards
Andreas Gehrs-Pahl
Re: Bug with descend (again)
on Sat, 06 Oct 2007 07:55:38 -0400
Christian,

>I have always problem with descend in index. I test and find 
>this strange behaviour:

>descend("2007",.T.) -> "╬ðð╔"
>descend("2002",.T.) -> "╬ðð╬"

Both of those I get, too.

>descend("2002",.T.) = descend("2007",.T.) -> .T.

This, I can't reproduce!

I have tried various settings, Set Exact On/Off, Set Lexical On/Off,
Set Collation ASCII/German, and any combination of those, including:

? descend("2002", .t.) == descend("2007", .t.)
? descend("2002", .f.) == descend("2007", .f.)
? descend("2002", .t.) =  descend("2007", .t.)
? descend("2002", .f.) =  descend("2007", .f.)

I always get the same, correct behavior, and the result is always "FALSE"
for this comparison! I tried with Xbase++ 1.82.306 as well as 1.90.331.

Are you sure that you get a different result?

-- Andreas

---                                                                      ---
  Andreas Gehrs-Pahl              E-Mail: GPahl@CharterMI.net
  415 Gute Street                     or: Andreas@DDPSoftware.com
  Owosso, MI 48867-4410               or: Andreas@Aerospace-History.net
  Tel: (989) 723-9927           Web Site: http://www.Aerospace-History.net
---                                                                      ---
Andreas Gehrs-Pahl
Re: Bug with descend (again)
on Sat, 06 Oct 2007 08:51:21 -0400
Christian,

>>descend("2007",.T.) -> "╬ðð╔"
>>descend("2002",.T.) -> "╬ðð╬"

>Both of those I get, too.

Actually, the above looks different to what I see in an OEM character set.
That's why I prefer the following nomenclature:

descend("2007", .t.) -> chr(206) + chr(208) + chr(208) + chr(201) 
descend("2002", .t.) -> chr(206) + chr(208) + chr(208) + chr(206) 

Which is calculated like this:
"2007" => chr(asc("2")) + chr(asc("0")) + chr(asc("0")) + chr(asc("7"))
"2002" => chr(asc("2")) + chr(asc("0")) + chr(asc("0")) + chr(asc("2"))

"2007" => chr(50) + chr(48) + chr(48) + chr(48) + chr(55)
"2002" => chr(50) + chr(48) + chr(48) + chr(48) + chr(50)

descend("2007") => chr(256 -50) + chr(256 -48) + chr(256 -48) + chr(256 -55)
descend("2007") => chr(256 -50) + chr(256 -48) + chr(256 -48) + chr(256 -50)

Typing this into this News Reader (using Courier New), I get this:
chr(206) + chr(208) + chr(208) + chr(201) ==> "ÎÐÐÉ"
chr(206) + chr(208) + chr(208) + chr(201) ==> "ÎÐÐÎ"

But comparing any of those strings with another will always return FALSE!

-- Andreas

---                                                                      ---
  Andreas Gehrs-Pahl              E-Mail: GPahl@CharterMI.net
  415 Gute Street                     or: Andreas@DDPSoftware.com
  Owosso, MI 48867-4410               or: Andreas@Aerospace-History.net
  Tel: (989) 723-9927           Web Site: http://www.Aerospace-History.net
---                                                                      ---