Wanted to sort the result of query in ascending / descending order in workflow before to display the records in the email.
Question
Question
Advance Search Syntax: How to Sort a Metadata Field
Answer
This feature has been added to Search Repositories and Find Entries in Workflow 9.2.1.
Replies
Advanced search syntax doesn't support any kind of sorting. The operations it supports are limited to the criteria that you can use in the search pane. The presentation of the returned data is all done client side.
If all you need is a list, you might be able to do something in a script:
SearchResultListing results = srch.GetResultListing(new SearchListingSettings()); var resultList = new List<string>(); for(int i = 1; i <= results.RowsCount; i++) { DocumentInfo docInfo = Document.GetDocumentInfo(results.GetEntryInfo(i).Id, wrapperSession); resultList.Add(docInfo.Name); } resultList.Sort();
EDIT: There are a few things you can do in Advanced Search Syntax that you can't do in the search pane, but they are limited to nuances of Boolean syntax that can't be expressed in the UI.
Note that if you're getting a listing in this fashion you can specify your desired sort via the SearchListingSettings object.
You're correct that the search syntax doesn't allow for specification of an ordering on the results.
Cool, so something like this?
var settings = new SearchListingSettings(); settings.SortColumn = SystemColumn.Name; // OR settings.SetSortColumn("Client Name", SortDirection.Ascending); SearchResultListing results = srch.GetResultListing(settings);