Qlik Community

Qlik Sense Integration, Extensions, & APIs

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

royal_87
New Contributor III

app.field('Field').selectValues() Don't work on all fields

The selectValues method don't work on every fields which is strange.

Example code that doesn't work

app.field('FrånvarandePeriod').selectValues(["2016/2017"], false, true);

Even tried the longer version

app.field('FrånvarandePeriod').selectValues([{qText: "2016/2017"}], false, true);


It doesn't give any errors, just an empty selection


But this works

app.field('FrånvarandeMånad').selectValues(["jan"], false, true);

Same code but different values


Someone who knows what the problem can be?

Thanks



1 Solution

Accepted Solutions
Employee
Employee

Re: app.field('Field').selectValues() Don't work on all fields

An easy way to check if a value has a numeric value is single configurator:

  1. open your app in Single Configurator
  2. in the option pannel under `Apply selections` - click on `Add data`
  3. select field => select value
  4. check your URL

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`


Alternatively, you can check qNum from one of the values => https://help.qlik.com/en-US/sense-developer/April2018/Subsystems/APIs/Content/CapabilityAPIs/FieldAP...

4 Replies
Employee
Employee

Re: app.field('Field').selectValues() Don't work on all fields

Hi royal.87‌,

I will guess that some of the values you are trying to select have a numeric representation, that's why sometimes it's not working, see => https://help.qlik.com/en-US/sense-developer/3.0/Subsystems/EngineAPI/Content/Classes/FieldClass/Fiel...

You may need to send qIsNumeric and qNumber (numeric representation) for certain values.

An easy way out is to use instead the selectMatch method => https://help.qlik.com/en-US/sense-developer/3.0/Subsystems/APIs/Content/MashupAPI/Methods/selectMatc...

I hope this helps,

royal_87
New Contributor III

Re: app.field('Field').selectValues() Don't work on all fields

Thanks Aiham you answer helped me on the way .

I have several selections with different fields so the selectMatch wont help because it will only be the last value selected in the end.


It don't work when I try with qNumber instead of qText, I think i need to convert the values to some kind of date value.

Employee
Employee

Re: app.field('Field').selectValues() Don't work on all fields

An easy way to check if a value has a numeric value is single configurator:

  1. open your app in Single Configurator
  2. in the option pannel under `Apply selections` - click on `Add data`
  3. select field => select value
  4. check your URL

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`


Alternatively, you can check qNum from one of the values => https://help.qlik.com/en-US/sense-developer/April2018/Subsystems/APIs/Content/CapabilityAPIs/FieldAP...

royal_87
New Contributor III

Re: app.field('Field').selectValues() Don't work on all fields

Awesome it works

I check if the value has qNum, if it does then i use that value instead of qText.

The solution Is for exporting and importing selections.


Thanks Aiham you are the best

Community Browser