searchResults method
This API is reliable and breaking changes are unlikely.
qlik.app.searchResults(qTerms, qPage, qOptions, callback)
Searches for one or more terms in the values of a Qlik Sense app.
Version history
Version state | Details |
---|---|
Introduced | 2.2 |
Parameters
qTerms
Type: Array
Terms to search for.
qPage
Type: Object
Properties:
Name | Type | Description |
---|---|---|
qOffset | Number | Position from the top, starting from 0. |
qCount | Number | Number of search results to return. |
qGroupOptions | Array |
This parameter is optional. Options of the search groups. If this property is not set, all values are returned. |
qGroupItemOptions | Array |
This parameter is optional. Options of the search group items. If this property is not set, all values are returned. |
qOptions
Type: Object
Optional.
Search options.
Properties:
Name | Type | Description |
---|---|---|
qSearchFields | Array | List of search fields. |
qContext |
Search context. Can be one of:
Default value is LockedFieldsOnly. |
callback
Type: Function
Optional.
Callback method. Registers a callback that is executed every time data is returned.
Returns
A promise of a Qlik associative engine reply.
Example
app.searchResults( ["ma"],
{ qOffset: 0, qCount: 15},
{qContext: 'CurrentSelections'},
function ( reply ) {
if ( reply.qResult.qTotalNumberOfGroups === 0 ) {
alert('No matches');
} else {
var str = "";
reply.qResult.qSearchGroupArray.forEach( function ( value ) {
value.qItems.forEach( function ( item ) {
str += item.qIdentifier +": ";
item.qItemMatches.forEach( function ( match ) {
str += match.qText + ' ';
} );
} );
} );
alert(str);
}
});