Qlik Community

Qlik Sense Integration, Extensions, & APIs

Discussion board where members can learn more about Integration, Extensions and API’s for Qlik Sense.

Announcements
Coming your way, the Qlik Data Revolution Virtual Summit. October 27-29. REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Partner
Partner

QlikSense Field API Promise

Hi All,

I am trying to identify if the below API resulted in some values or not but the response always comes as true. Could you please help me understand what am i doing wrong here.

I have an input box where i search for some values and hit the search button. On click I have written a function that executes the below statement. However, the response i am not able to identify as to success or failure.

app.field('FIELDNAME').selectValues([6574], false, false).then(function(reply) {

                    console.log(reply);

                })

When i search for a value which is not there in the field, even then the reply prints true.

This is part of a mashup that i am building.

Thanks,
Aadil

3 Replies
Highlighted
Contributor III
Contributor III

I'm having a hard time with this too. Did you solve this somehow?

Highlighted

Hi,

It's not clear from the documentation but I'm pretty sure selectValues returns true even if you try to select a non-existing value.

Erik Wetterberg

Highlighted
Contributor III
Contributor III

You are correct Erik. I managed to solve my requirements by using enigma.js to evaluate an expression and see if there's a value that fits my needs.

For anyone who wants to use, it's simple as:


app.model.enigmaModel.evaluate("=Count({$<"+field+"={'"+searchText+"'}>} "+field+")").then(function(reply) {      if(reply == 0) {
     console.log('ops! there is no value that corresponds to this search');

     return;
}
});