>Can someone help me with my problem? I have a table consisting of LName C(20) GName C(20) Grade C(2)
> && Note: Grade contains mixed of Alpha and Numeric
>I am trying to sort my table using a function inside my Stored Procedure which will alphasort combining grade and name
>
>My function inside the Stored Proc goes like this:
>
>Function asort
> DO CASE
> case grade="1"
> nretval = 10
> case grade="2"
> nretval = 12
> case grade="3"
> nretval = 14
> case grade="1b"
> nretval = 20
> ENDCASE
> cOrder = ALLT(STR(nRetVal) + UPPER(ALLT(Lname)+ALLT(gName))
>RETURN cOrder
>
>I noticed that if u return an Character it wont sort properly but if u return a numeric the sorting goes well.
>Someone have an idea about This... Thanks. I reallt appreciate ur reply.
>
>
>
>This is only a sample table that i can come up.
You don't tell which sorting problem you have. My guess is that it should be related to collating sequence. When you issue a SET("COLLATE") the answer is probably MACHINE. That is that an "a" or a "A" are sorted according to their ASCII value. Most of the time this is not appropriate for text fields. And you might to change the collating sequence in this fashion:
SET COLLATE TO GENERAL
INDEX
ON
SET COLLATE TO MACHINE
The best site to get information about the VFP international features is www.stevenblack.com
José