Qlik Community

Qlik Sense Integration, Extensions, & APIs

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

Announcements
See why BI users voted Qlik #1 in 11 categories. GET REPORT
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Partner
Partner

Locking field selection using JS in Mashup

Hi All,

I am trying to pass a field value using app.field and selectvalues method and it also appears in the selection pane. What I want to do is lock that selection or hide that selection so that no user can change the values of that particular dimension. Does anyone have any method or a way to solve this issue preferably using JS.  

1 Solution

Accepted Solutions
Partner
Partner

Hey @aaz ,

Thanks for the solution. Had to make some amendments to it as 'await' did not work properly in the mashup. Here I am also pasting my code for further reference. 

var app = qlik.openApp('app id');
app.field('field').selectValues([{qText: "value"}], false, false);
app.field('field').lock();

Let me know if this doesn't work properly for anyone. 

Thanks.

View solution in original post

2 Replies
Highlighted
Employee
Employee

Hi @garvit96 ,

You should be able to do:

const field = await app.field('your_field');
await field.selectValues(...);
await field.lock();

https://help.qlik.com/en-US/sense-developer/September2019/Subsystems/APIs/Content/Sense_ClientAPIs/C...

I hope this helps 

Partner
Partner

Hey @aaz ,

Thanks for the solution. Had to make some amendments to it as 'await' did not work properly in the mashup. Here I am also pasting my code for further reference. 

var app = qlik.openApp('app id');
app.field('field').selectValues([{qText: "value"}], false, false);
app.field('field').lock();

Let me know if this doesn't work properly for anyone. 

Thanks.

View solution in original post