Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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
I'm having a hard time with this too. Did you solve this somehow?
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
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;
}
});