Copy link to clipboard
Copied
Is there a way to sort results manually without having to build stupidly complex arrays?
I need to sort initially in a very specific way like so:
Beer
Orange Juice
(then by A-Z)
Apple Juice
Brandy
Carrott Juice
Blah blah blah through to Z
Is it possible to do this even if I have to add the products in order manually?
I'm using PHP and MySQL.
Thank you.
Copy link to clipboard
Copied
OK, so just to let you know that I am getting something, but it's by no means right, but messing with the code does seem to alter the sort order:
ORDER BY DrinkType = 'Beer', DrinkType = 'Orange Juice', DrinkType = 'Apple Juice', DrinkType = 'Brandy', DrinkType = 'Carrot Juice', etc...
However, by presenting it in this manner, the results print backwards like so:
etc
Carrot Juice
Brandy
Apple Juice
Orange Juice
Beer
This is all very well, and I could change the order of the ORDER BY to be backwards so that it prints properly, but this isn't flexible and doesn't allow for new entries. Any new drink type NOT included prints before the specified sort order.
Does anybody have any thoughts on this?
Thanks.
Copy link to clipboard
Copied
How about creating a new column called 'sortfield'. Assign 'aaa' to Beer and 'aab' to Orange Juice. For the rest of the items populate it with the same value as DrinkType. You could create a trigger to do that for you. Then just sort on the sortfield.
Copy link to clipboard
Copied
I came across this extension of Tom Muck
http://www.tom-muck.com/extensions/help/SortRepeatRegion/
I never used it myself.
I used other extensions of Tom Muck an they were OK.
Best Regards,
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more