Qlik Community

Qlik Sense Integration, Extensions, & APIs

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

billgates
Contributor

Qlick Sense 3.0 How to programmatically set selections by value?

Hello!

I'm beginner in qlik and I'm trying work with Qlick Sense 3.0 programmatically


I'm working with application described here

I can't programmatically get selections, please assist

This time, i want to set selections for field programmatically.

I can do it by next commands and it works:

app.field('Year').select([0], false, false);

app.field('Year').select([0, 1, 2], true, true);

app.field('Year').selectMatch('1997', true);

app.field('Year').selectAll();

But when I'm trying to select multiple values by value, nothing happening.


my code is:

app.field('Year').selectValues([{qText: '1997'}, {qText: '1998'}, {qText: '1999'}], true, true);


Example I took from this instructions:

https://help.qlik.com/en-US/sense-developer/3.0/Subsystems/APIs/Content/MashupAPI/Methods/selectValu...


PS


When I'm printing field values in console by next code:

$.each(app.field('Year').getData().rows, function(key, value) {

  console.log(value.qText);

});

I'm receiving correct values:

h_1472638260_9659500_2b2fa2a9bf.png

Thanks

Please assist...

1 Solution

Accepted Solutions
Employee
Employee

Re: Qlick Sense 3.0 How to programmatically set selections by value?

Hi,

My guess will be that those FieldValues have a Numeric representation, while you are sending only qText:

http://help.qlik.com/en-US/sense-developer/3.0/Subsystems/EngineAPI/Content/Classes/FieldClass/Field...

You should check if qNumeric === true and if so send instead qNumber && qNumeric.

2 Replies
Employee
Employee

Re: Qlick Sense 3.0 How to programmatically set selections by value?

Hi,

My guess will be that those FieldValues have a Numeric representation, while you are sending only qText:

http://help.qlik.com/en-US/sense-developer/3.0/Subsystems/EngineAPI/Content/Classes/FieldClass/Field...

You should check if qNumeric === true and if so send instead qNumber && qNumeric.

billgates
Contributor

Re: Qlick Sense 3.0 How to programmatically set selections by value?

Thanks, Alham!

looks like for my purpose enough and it works:

app.field('Year').selectValues([1997, 1998, 1999, 2000], true, true);

Community Browser