|
Home > Archive > Programming with dBASE > February 2006 > Set order
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
|
|
| Simon 2006-02-14, 11:23 am |
| what is the best way to organise the fallowing strings (from a SQL query)
"CC-790"
"CC-8"
"CC-80"
"CC-800"
to this order
"CC-8"
"CC-80"
"CC-790"
"CC-800"
Is there a way with Local SQL to do it ? or is there a class that can andle that sort?
thanks
Simon
| |
| *Lysander* 2006-02-14, 11:23 am |
| Simon schrieb:
> to this order
>
> "CC-8"
> "CC-80"
> "CC-790"
> "CC-800"
>
> Is there a way with Local SQL to do it ? or is there a class that can andle that sort?
I doubt that there will be any good and easy solution.
You either must pad your "number" part of the string with blanks or
zeros (like " 8" or "008" for "8 ", or you have to keep the
information for the "text" part and for the "number" part in
different columns, combining them only for viewing at runtime, or do
any calc-fields.
If it is possible to do this with an expression index then I would
rather be discourage to touch such a solution. There's a high
potential for numerous crashes afterwards.
ciao,
André
| |
| evilaro 2006-02-14, 1:23 pm |
| Simon:
I feel there is no easy solution, but if your numbers instead of having
different lens you make one len then no problem.
When I have to do this I thing which is the largest number I will use
If the answer is 5000 then
my numbering will start at 1001, so always I will get 4 characteres
if starting at 1001 is not acceptable use the
A0001 looks better than 0001
I hope it helps
Emilio
"Simon" <scordeau@icube.ca> escribió en el mensaje
news:pvkbvAYMGHA.2016@news-server...
> what is the best way to organise the fallowing strings (from a SQL query)
> "CC-790"
> "CC-8"
> "CC-80"
> "CC-800"
>
> to this order
>
> "CC-8"
> "CC-80"
> "CC-790"
> "CC-800"
>
> Is there a way with Local SQL to do it ? or is there a class that can
andle that sort?
>
> thanks
>
> Simon
| |
| Ivar B. Jessen 2006-02-14, 1:23 pm |
| On Tue, 14 Feb 2006 11:03:24 -0500, in dbase.programming,
Subject: Set order ,
Message-ID: <pvkbvAYMGHA.2016@news-server>,
Simon <scordeau@icube.ca> wrote:
>what is the best way to organise the fallowing strings (from a SQL query)
>"CC-790"
>"CC-8"
>"CC-80"
>"CC-800"
>
>to this order
>
>"CC-8"
>"CC-80"
>"CC-790"
>"CC-800"
>
>Is there a way with Local SQL to do it ? or is there a class that can andle that sort?
Try this.
Ivar B. Jessen
//-----
close tables
if file("simon.dbf")
drop table simon
endif
create table simon(name char(6))
insert into simon values ("CC-790")
insert into simon values ("CC-8")
insert into simon values ("CC-80")
insert into simon values ("CC-800")
select name, cast(substring(name from 4 for 3) ;
as integer) as subsimon ;
from simon order by subsimon
list
//-----
|
|
|
|
|