You are here:
Define Advanced Search
The AdvancedSearch feature helps you filter your search based on certain criteria. You can define the advanced search capability in the ListObject contract by defining the searchable property on a grouped list.
Required Editions
There are two types of searches: in-memory and in-database. In the in-memory search or quick search, the search is run on the entire list that’s loaded in memory. However, in the in-database search or advanced search, the data source is run by using advanced search conditions. If you set paging as true for the list, the in-database search method is applied because in-memory search searches only the portion of the list that’s loaded at a given time due to pagination. Each parameter also includes an operator window with which users can specify an operator value (for example, Contains and Greater) for search parameters as shown here. The favorite button is visible only if you set favorites. After you set a favorite by using the Save as My Favorite button, the Favorite option is available. After you click the Delete My Favorite button, your saved favorites and the Favorite button are deleted. So, as long as you store favorites, the Favorite option is available.
| Available in: Enterprise, Performance, and Unlimited Editions |
| User Permissions Needed | |
|---|---|
| To configure advanced search: | Customizer, Admin |
To define the advanced search capability, use the AdvancedSearchObject node in the ListObject contract. You can define search parameters by using the AdvancedSearchAttribute elements. To define quick search, use QuickSearchParameters in the Datasource contract.
-
Define Advanced Search Objects in the ListObject Contract.
You can define AdvancedSearchObjects in ListObject Contract as shown here.
<AdvancedSearchObjects> <AdvancedSearchObject name="AsoContracts"> <AdvancedSearchAttributes profileId="default"> <!--<AdvancedSearchAttribute label="LoPrmContracts_SloganId" property="prmText" type="Text" />--> <!--<AdvancedSearchAttribute label="LoPrmContracts_CustomerNameId" property="customerName" type="Text" />--> <AdvancedSearchAttribute label="LoPrmContracts_CustomerNameId" property="customerPKey" lookupProcess="Customer::LookupProcess" lookupProcessReturnValue="customerPKey" lookupObject="LuCustomer" lookupObjectDisplayValue="name" type="Lookup" /> <AdvancedSearchAttribute label="LoPrmContracts_PhaseId" property="phase" type="Selection" toggleId="PrmContractPhase" /> <AdvancedSearchAttribute label="LoPrmContracts_DateFromId" property="dateFrom" type="Date" /> <AdvancedSearchAttribute label="LoPrmContracts_DateThruId" property="dateThru" type="Date" /> <AdvancedSearchAttribute label="LoPrmContracts_Owner" property="ownerPKey" lookupProcess="User::LookupProcess" lookupProcessReturnValue="userPKey" lookupObject="LuUser" lookupObjectDisplayValue="name" type="Lookup" /> <AdvancedSearchAttribute label="LoPrmContracts_User" property="responsiblePKey" lookupProcess="User::LookupProcess" lookupProcessReturnValue="userPKey" lookupObject="LuUser" lookupObjectDisplayValue="name" type="Lookup" /> </AdvancedSearchAttributes> </AdvancedSearchObject> </AdvancedSearchObjects> -
Define the name of Advanced Search Object (ASO) as a parameter in the process LOAD
action that loads the ListObject, as shown here.
<Action name="GetCustomerContractList"actionType="LOAD"type="LoPrmContracts"> <Parameters> <Input name = "aso" value="AsoContracts" type="Literal" /> </Parameters> <Return name = "ProcessContext::CustomerContractList" /> </Action>
Note Steps 3 and 4 are specific to in-database search. -
If you use a manually created Load method for your List Object, add these code snippets
to the Load method to load AdvancedSearch Object.
<BusinessLogic methodName="loadAsync"businessObjectClass="<LO-Name>" accessibility="PUBLIC" asynchronous="true" final="false" module="CORE"> <Parameters> <MethodInput name = "jsonParams" type="Object" /> </Parameters> <Code language = "JavaScript"> <![CDATA[ var me = this; var deferred =when.defer(); me.addAsoInformation(jsonParams) .then(function(success) { ...(your load method) / example code Facade.getListAsync(<LO_NAME>,jsonParams) .then(function(items) { me.addItems(items, jsonParams); deferred.resolve(me); ); / end of example code }); var promise = deferred.promise; ]]></Code> <Return name = "loOrderOverview" value="promise" /> </BusinessLogic> -
To allow in-database advanced search, extend the data source. For in-database search,
filter search parameters by using conditional statements and SQL statements as shown
here.
<ConditionalParameter name="City"> <SimpleConditions> <Condition leftSideValue = "ClbMain.City" comparator="#CityComp#" rightSideType="Attribute" rightSideValue="#City#" /> </SimpleConditions> </ConditionalParameter>If you use an external data source for the database search, include this code snippet.
var newParams = null; if(Utils.isDefined(jsonQuery)) { newParams = jsonQuery; if (Utils.isOldParamsFormat(newParams)){ newParams = Utils.convertDsParamsOldToNew(newParams); } }Add this code snippet for each additional parameter, where <Name> is the parameter name and <Column> is the column name as required in the SQL statement.
if (Utils.isDefined(newParams) && Utils.isDefined(newParams.<Name>)){ sqlStmt += " AND <Column> " +Utils.replaceOperator(newParams.<Name>Comp) + "'#<Name>#'"; }

