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

Question

Question

Sorted Search Results in a script

SDK
asked on October 6, 2014

Hello...

I need to use an advanced search command in a VBScript and I would like to have the results sorted in a particular order.  

If this is possible, what is the syntax to accomplish this?

Thanks you...

Dennis

0 0

Answer

SELECTED ANSWER
replied on October 6, 2014

Hi Rob...

Will do.

0 0

Replies

replied on October 6, 2014

For VBScript you should use LFSO (the COM SDK), here is a simple example of running a search and retrieving the results sorted by template name:

 

set search  = db.CreateSearch
search.Command = "my search term"
search.BeginSearch(true)

set params = CreateObject(version & ".SearchListingParams")

' Define some of the common column IDs since the Column_Type enumeration isn't available in vbscript
COLUMN_TYPE_ID = 1
COLUMN_TYPE_NAME = 2
COLUMN_TYPE_TEMPLATENAME = 4
COLUMN_TYPE_VOLUMENAME = 5
COLUMN_TYPE_LINKTO = 6
COLUMN_TYPE_CREATEDATE = 8
COLUMN_TYPE_LASTDATE = 9
COLUMN_TYPE_NUMPAGES = 10
COLUMN_TYPE_MIMETYPE = 12
COLUMN_TYPE_EXTENSION = 13
COLUMN_TYPE_PATH = 36
COLUMN_TYPE_HITCOUNT = 37
COLUMN_TYPE_DISPLAYNAME = 38
COLUMN_TYPE_ENTRYTYPE = 39
COLUMN_TYPE_ELEC_SIZE = 52

SORT_DIRECTION_ASC = 1
SORT_DIRECTION_DESC = 2

params.AddStandardColumn(COLUMN_TYPE_ID)
params.AddStandardColumn(COLUMN_TYPE_NAME)
params.AddStandardColumn(COLUMN_TYPE_TEMPLATENAME)

params.AddColumnTypeToSortBy COLUMN_TYPE_TEMPLATENAME, SORT_DIRECTION_ASC
set listing = search.GetSearchResultListing(params, 0)
For i = 1 To listing.RowCount
	MsgBox listing.DatumByColTypeAsString(i, COLUMN_TYPE_TEMPLATENAME)
Next

 

0 0
replied on October 6, 2014

See SetSortColumn method in SearchListingSettings in your SDK documentation.

0 0
replied on October 6, 2014

Hi Robert and Miruna....

Thank you for the replies.  I will try the COM method.

This answered my question.

 

Regards......

Dennis

 

0 0
replied on October 6, 2014

Hello Dennis,

 

If your question has been answered, please remember to select the "This answered my question" button below the appropriate post!

 

Thanks!

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

Sign in to reply to this post.