You are viewing limited content. For full access, please sign in.

Question

Question

Advance Search Syntax: How to Sort a Metadata Field

asked on June 14, 2014

Wanted to sort the result of query in ascending / descending order in workflow before to display the records in the email. 

0 0

Answer

APPROVED ANSWER
replied on May 20, 2015

This feature has been added to Search Repositories and Find Entries in Workflow 9.2.1.

0 0

Replies

replied on June 16, 2014 Show version history

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.

0 0
replied on June 16, 2014

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.

0 0
replied on June 16, 2014

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);

 

1 0
You are not allowed to follow up in this post.

Sign in to reply to this post.