Customising Order Values in Query

Vespertin

Registered User.
Local time
Today, 15:36
Joined
May 8, 2011
Messages
11
Hi,

in a standard query I know you can order results by ascending and descending A-Z but in my query there is a field [category] which always has one of 3 values, "Ordered", "Saved", "Bought". Can I order them exactly as below?

"Ordered"
"Saved"
"Bought"

Is it possible to customise the Order By in a query?
 
I would make a new field in your query called 'SortOrder', assign it a value based on the 'category' and then order the query by that field. It would look like this:

PHP:
SortOrder: Iif([category]='Ordered', 1,0) + Iif([category]='Saved', 2,0) + Iif([category]='Bought', 3,0)

Then both hide that column and put it in ascending order and your query should be ordered correctly.
 
Plog

That worked perfectly, thanks for your help, really appreciated.
 

Users who are viewing this thread

Back
Top Bottom