Seen A post Other Day about Sorting. Cant find solution or Post

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Seen an unanswered post the other day and was interested in what the solution
may be. The question was or simular to:

If you wanted to sort by colors VS. Acending or decending in a query.

For example: Sort first by red then green, blue yellow.

I was interested in this post becuase occassionally you want to sort
differently and just sticking a sort column in a querry to get around it
seems to provide an easy solution. However, I was wondering the different
solutions available to this problem.

Thanks.
 
In other words, you want an alpha sort, but want ZEBRA to show up before
anteater, because you just LOVE Zebra's?

Weight the results.
Instead of one coloum, for Animal, filled with apples and zebras and
hippos, have TWO. One just like the above, but BEFORE it, have a coloum
called zebra:iff([animal]="zebra",0,1)
Then sort both. Zebras and only Zebras will be Zero, wo will sort to
the top, everything else will be NOT zebras, and will then sort by alpha.

You can completely customize your sort, by giving each value a ranking,
using switch. Red is 1, Green is 2, Yellow is 3, Brown is 4, put that
as a field in a coloum, and sort by that field.
 
You could add an expression in your sorting and grouping dialog like:

=Instr("red green blue yellow",[ColorField])

I would actually create a small lookup table of colors with a sorting field.
 
Sometimes, if you are only talking about a few values, building and
joining to a lookup table is more hassle than it's worth.

However, your instr() trick is genius. You don't get clean 1234 t7pe of
ranking, but for this purpose you don't need it.
 
Back
Top