1 Reply Latest reply: Jul 11, 2016 9:10 AM by Alexander Karlsson RSS

    How to filter a chart using an API?

    Aleksander Wasilewski

      Hello.

       

      I've got a following simple code:

       

      var config = {

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

          prefix: "/",

          port: 443,

          isSecure: true

      }

       

      require.config({

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

      });

       

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

          qlik.setOnError(function (error) {

              alert(error.message);

          });

        

          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

       

      Aleksander