Qlik Community

Qlik Sense Integration, Extensions, & APIs

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

Not applicable

How to filter a chart using an API?


I've got a following simple code:

var config = {

    host: "sense-demo.qlik.com",

    prefix: "/",

    port: 443,

    isSecure: true



    baseUrl: (config.isSecure ? "https://" : "http://") + config.host + (config.port ? ":" + config.port : "") + config.prefix + "resources"


require(["js/qlik"], function (qlik) {

    qlik.setOnError(function (error) {




    var app = qlik.openApp("d972b07b-fd90-466c-97be-b7aeecca29ee", config);

    app.getObject($("#myDiv"), "cReWKcL");


    app.field("Team Name").selectMatch("Cubs", false); //Here I'm trying to display a chart only for the Cubs team


And it appears to be non-deterministic. Once I get a one bar (only for the Cubs) and after few reloads I get a chart for all of the teams. And the other way around.

Could you provide some help regarding how to apply filtering on charts using JS API?

Thanks in advance


Tags (2)
1 Reply

Re: How to filter a chart using an API?

The methods are async so you can't rely on app.getObject to finish before you issue your selection.

Luckily all methods in the Capabilities API return a promise so you can establish some kind of flow control,

pseudo code:

app.getObject('mydiv', 'myobjectid').then(() => {

  app.field('myfield').selectMatch('Cubs', false)


Community Browser