Please enable JavaScript to view this site.

Navigation: Advanced topics > Programming topics > Search API > Methods

Search API: setSearchOption

Scroll Prev Next More

 

Sets the search option for the field. The list of search options is available in the Arguments section. This code should go to AfterTableInit event of the List page.

Syntax

setSearchOption($field, $option);

Arguments

$field

the name of the field.

$option

an option to be set. Accepts one of the following as the search option:

CONTAINS

EQUALS

STARTS_WITH

MORE_THAN

LESS_THAN

BETWEEN

EMPTY_SEARCH

NOT_CONTAINS

NOT_EQUALS

NOT_STARTS_WITH

NOT_MORE_THAN

NOT_LESS_THAN

NOT_BETWEEN

NOT_EMPTY

Example 1

How to make sure that the BETWEEN option is always selected for the Year field .

 

$srchObj = SearchClause::getSearchObject("Employees");
$option = $srchObj->getSearchOption("Year");
if ($option != BETWEEN) {
$srchObj->setSearchOption("Year", BETWEEN);
}

Created with Help+Manual 7 and styled with Premium Pack Version 3 © by EC Software