Sorting numbers properly 
Author Message
 Sorting numbers properly
Hi,

Now I've got a problem that I'm sure many have had to suffer through
before...

I was to sort numbers from 1 to 1000....but of course, I need to have my
numbers formatted properly so that 10 doesn't come before 1 when I do the
sort, etc, etc,

How can I do this properly?  I've checked the help files, but nothing seems
to be working quite right....

Thanks,

Serafino



Wed, 26 Dec 2001 03:00:00 GMT
 Sorting numbers properly

There are three possible solutions that I can think of. (listed in order of
difficulty)

1. Make sure the data type is numeric and not text

or

2. If the numbers must be text, If you can put leading zeros on, then the
numbers will sort correctly.

or

3. If you cannot put leading zeros for some reason - any reason..  You could
set up
two arrays, one with the original, one with the either numeric data type or
leading zeros..

#3 Example:

original
1
23
10
2

sortable
01
02
10
23

Quote:

>Hi,

>Now I've got a problem that I'm sure many have had to suffer through
>before...

>I was to sort numbers from 1 to 1000....but of course, I need to have my
>numbers formatted properly so that 10 doesn't come before 1 when I do the
>sort, etc, etc,

>How can I do this properly?  I've checked the help files, but nothing seems
>to be working quite right....

>Thanks,

>Serafino



Thu, 27 Dec 2001 03:00:00 GMT
 Sorting numbers properly
Ok,

I have set up the dB data with leading zeros, and that works fine, but that
seems like a bandaid on what should be a relatively simple procedure...

I've dimmed the variable as integer, and the dbgrid property to a general
number...

Is there something I'm missing here?

My select statement is dependent on which dbgrid column header you click on,
so I don't know if changing that would be a good idea, since some of the
columns contain text, etc...

Thanks for the help!

Serafino



Thu, 27 Dec 2001 03:00:00 GMT
 Sorting numbers properly
Duh!

I never set it to a number when I was setting up the fields...

I'm so sorry for having wasted your time with this stupid problem...

I knew it was something I was overlooking...

I am an idiot....

Thanks for the help, though!

Serafino



Thu, 27 Dec 2001 03:00:00 GMT
 
 [ 4 post ] 

 Relevant Pages 

1. Create date colum in EM does not sort properly

2. PLEASE HELP - cursor doesn't seem to sort properly

3. Sorting text and number(the 2 in the same field)

4. Sorting numbers in MSFlexGrid

5. SORTING PROBLEM WHEN NUMBERS ARE MIXED WITH LETTERS

6. Sorting Numbers in VarChar variable

7. help with number sorting basics

8. Big-oh statistics for number of comparisons and run time of new patented sorting algorithm

9. sorting outline numbered sections

10. Sorting numbers in Descending Order using ORDER BY

11. Sorting Numbers in Text Field


 
Powered by phpBB® Forum Software