Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
aadil_madarveet
Partner - Creator II
Partner - Creator II

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

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

ErikWetterberg

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

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