Data:
Inbox
Something
Import-1
....
Import-13
Sent
Other Stuff
The function
CREATE OR REPLACE FUNCTION PathSort(thePath STRING) RETURNS STRING BEGIN CASE WHEN LOWER(list_nthitem(thePath, 1, ':::')) = 'inbox' THEN RETURN concat('1:', REPLACE(thePath, ':::', chr(10))); WHEN LOWER(list_nthitem(thePath, 1, ':::')) = 'sent' THEN RETURN concat('2:', REPLACE(thePath, ':::', chr(10))); WHEN LOWER(list_nthitem(thePath, 1, ':::')) = 'sent messages' THEN RETURN concat('2:', REPLACE(thePath, ':::', chr(10))); WHEN thePath = 'Trash' THEN RETURN concat('7:', REPLACE(thePath, ':::',chr(10))); WHEN thePath = 'Spam' THEN RETURN concat('3:', REPLACE(thePath, ':::', chr(10))); WHEN LOWER(list_nthitem(thePath, 1, ':::')) = 'views' THEN RETURN concat('4:',REPLACE(thePath, ':::', chr(10))); WHEN LOWER(list_nthitem(thePath, 1, ':::')) = 'Mailboxes' THEN RETURN concat('5:', REPLACE(thePath, ':::', chr(10))); ELSE RETURN concat('6:', REPLACE(thePath, ':::', chr(10))); END CASE END
is used to sort
Inbox
Sent
other mailboxes
(simplified). If I sort the result of the function with
select RecID, MailboxPath, WhereClause, PathSort(MailboxPath) from mailbox order by 4
I get
Import-1
Import-10
Import-2
and so on. Bug or feature?
Mit freundlichen Grüßen/Regards
Beatrix Willius
http://www.mothsoftware.com
Mail Archiver X: The email archiving solution for professionals