Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all,
I try to use field api. I have array of string values, field name and state name.
My function in extension is something like this:
function selectByValue(fieldname,value,state){
var app = qlik.currApp();
var field = app.field(fieldname,state);
field.clear;
field.selectValues(value,true,true);
}
In result. I see all selected values in a field and it ignores state.
How do i use selectValues with state?
Thanks
Hi,
Cool with someone that tries to use state! Have you created the state?
To clear a field you need to call the clear method :
field.clear(); //your example is missing the () which means the function will not be called
The clear method returns a promise, which resolves when QIX engine replies to the call. If you want to have control over the order of the calls (and you probably do) you need to wait for the clear before making the selection, like this:
field.clear().then(function(){
field.selectValues(value,true,true);
});
Hope this helps
Erik Wetterberg
Thanks for answer! Tell me please, how create state using api in my function to select values with this state? My function gets only name of state that i want to use.
Thank you very much! It's worked