Qlik Community

Qlik Sense Integration, Extensions, & APIs

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

aadil_zyme
Contributor

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
thpessato
New Contributor III

Re: QlikSense Field API Promise

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

erik_wetterberg
Valued Contributor III

Re: QlikSense Field API Promise

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

Erik Wetterberg
https://extendingqlik.upper88.com/
thpessato
New Contributor III

Re: QlikSense Field API Promise

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;
}
});