Smart search filter dropdown order

Nicole Johnson asked on January 20, 2015 12:36

I have a smart search filter used for filtering news items by date.

I tried to use the Values box in the smart search filter configuration, but the text was over 1000 so I got an error. I have now changed this to use a query which is working as I wanted and filters correctly, but the order of the dropdown is not correct.

Sample of my query is as follows:

SELECT '','','All'
UNION
SELECT 'NewsReleaseDate','[{%ToSearchDateTime(CurrentDateTime.AddDays(-7))#%} TO {%ToSearchDateTime(CurrentDateTime)%}]','Past week'
UNION
SELECT 'NewsReleaseDate','[20141201 TO 20141231]','Dec 2014'
UNION
SELECT 'NewsReleaseDate','[20141101 TO 20141130]','Nov 2014'
UNION
SELECT 'NewsReleaseDate','[20140701 TO 20140731]','Jul 2014'

This results in the following dropdown:

All, Past week, Jul 2014, Nov 2014, Dec 2014

Can anyone tell me how I can get the dropdown in the same order as the values are entered?

All, Past week, Dec 14, Nov 14, Jul 2014?

Correct Answer

Brenden Kehren answered on January 20, 2015 13:59

Does the query error out if you add a fourth column? This could be your order.

SELECT '','','All', 1
UNION
SELECT 'NewsReleaseDate','[{%ToSearchDateTime(CurrentDateTime.AddDays(-7))|(identity)GlobalAdministrator%}]','Past week', 2
UNION
SELECT 'NewsReleaseDate','[20141201 TO 20141231]','Dec 2014', 3
UNION
SELECT 'NewsReleaseDate','[20141101 TO 20141130]','Nov 2014', 4
UNION
SELECT 'NewsReleaseDate','[20140701 TO 20140731]','Jul 2014', 5
ORDER BY 4
2 votesVote for this answer Unmark Correct answer

   Please, sign in to be able to submit a new answer.