Qlik Community

Qlik Sense Integration, Extensions, & APIs

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

ygfletch
New Contributor II

Using Field API SelectValues method on field with "Always One Selected Value" setting turned on

Hi Qlik Community,

I have already created some extensions that use the Field API to make selections using the various qField methods. These are working fine however if I now set a fields settings to the new always one selected value option, the selections are not being applied. I've tried clearing the selection with the API first, however this doesn't work (as expected with that setting turned on). Changing the selection from the toolbar with usual user input is working fine and only allows one value to be selected.

Any ideas on how we can make selections via API on always one selected value fields?

Many thanks,

Graham

Tags (2)
1 Solution

Accepted Solutions
Highlighted
ygfletch
New Contributor II

Re: Using Field API SelectValues method on field with "Always One Selected Value" setting

Thank you Erik, you've at least lead me to the answer... the filterpanes I know use the backendAPI.selectValue method so I played around with this. Turns out you need to have qToggleMode set to false for it to work with one selected value. Not sure I understand that argument correctly, seems the wrong way round in my head!

For completeness...

I'm using the Field API from the Capability API, so the call is something like...

 

qlik.app.field("FieldName").selectValues(["value"],true,true)

 

For it to work I have just changed the second argument to false, which in the docs is toggle.

 

qlik.app.field("FieldName").selectValues(["value"],false,true)

 

I've found this description of the argument under the backendAPI docs which explains it better...

 

qToggleMode

Type: Boolean

If true, values in the field are selected in addition to any previously selected items.

If false, values in the field are selected while previously selected items are deselected.

View solution in original post

2 Replies
ErikWetterberg
Honored Contributor

Re: Using Field API SelectValues method on field with "Always One Selected Value" setting

What calls are you using?

You could use the browser developer tools to see what commands the client uses to make this work. Check what is sent on the web socket when you make the selection.

Highlighted
ygfletch
New Contributor II

Re: Using Field API SelectValues method on field with "Always One Selected Value" setting

Thank you Erik, you've at least lead me to the answer... the filterpanes I know use the backendAPI.selectValue method so I played around with this. Turns out you need to have qToggleMode set to false for it to work with one selected value. Not sure I understand that argument correctly, seems the wrong way round in my head!

For completeness...

I'm using the Field API from the Capability API, so the call is something like...

 

qlik.app.field("FieldName").selectValues(["value"],true,true)

 

For it to work I have just changed the second argument to false, which in the docs is toggle.

 

qlik.app.field("FieldName").selectValues(["value"],false,true)

 

I've found this description of the argument under the backendAPI docs which explains it better...

 

qToggleMode

Type: Boolean

If true, values in the field are selected in addition to any previously selected items.

If false, values in the field are selected while previously selected items are deselected.

View solution in original post