Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I can't get thhe selectValues method to work.
Using the example on https://help.qlik.com/en-US/sense-developer/June2018/Subsystems/APIs/Content/CapabilityAPIs/FieldAPI..., I am trying to set field values using qText values.
For example, I have a Weekday field that looks like this (from app1.field("Weekday").getData()):
I've tried selecting values by using:
weekdayField.selectValues([{qText: "Thu"}], false, false);
and
weekdayField.selectValues(["Thu"], false, false);
and
weekdayField.selectValues(["Thu", "Fri"], true, true);
but none of these work. They don't produce a JavaScript error, but they don't do anything.
I am, however, able to select values by index using:
weekdayField.select([1, 3], true, true); <-- works like a charm.
What am I doing wrong since selectValues isn't working?
May be try like this:
An easy way to check if a value has a numeric value is single configurator:
Example from Helpdesk Management app the Filed Dat with value 10/14/2010 is resulting in the URL as `&select=clearall&select=Date,40465` <= `40465`
Refer this link:
May be try like this:
An easy way to check if a value has a numeric value is single configurator:
Example from Helpdesk Management app the Filed Dat with value 10/14/2010 is resulting in the URL as `&select=clearall&select=Date,40465` <= `40465`
Refer this link:
Refer this:
Bala, you are right. I tried your suggestion and sure enough, "myField.selectValues([43282], false, false);" works.
Unfortunately, this is not very useful to me since I need to set values based on the display values that the following function gives me in the first place:
app1.getList("CurrentSelections", function(reply) {
...
}
This function returns values in the visual format (e.g. "Aug 2018"), but then when I want to set this loaded value later using selectValues, I have to use '43282' instead. Not too intuitive...
Right now it looks like my best bet is to translate the visual value (e.g. "Aug 2018") to an index number by using getData(), then set the value using field.select([indexNo], false, true). It's a bit of a detour, but I'm hoping it will get the job done.
I'm having the exact same challenge. My extension allows users to save the selection state and then re-apply at a later stage. But when re-applying selections, I can't consistently use selectValues, as some of those fields might be in date/numeric format and won't work.
At the same time, the SelectionObjectDef which is returned by app.selectionState or "CurrentSelections" does not contain the qNum property for each selection value. Just great.
So the challenge is, how do you determine if the field value is a date or not? To Javascript it's just a string.
Similar to your suggestion, looks like for every selection I want to apply, I'll have to get the field from Sense so that at least I have the qText/qNum equivalent and can determine if I should use the string or number when calling selectValues. A bit of an overkill I wanted to avoid, but can't see any other options at the moment.