Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

QlikSense Mashup API - Issue in setting the parameter

Hello,

We are in the process of integration QlikSense with ASP.NET using Mashu API. We use the Named license to generate token for the web ticketing.

The database contains details of multiple clients and based on user login we have a logic to pass the Client ID to the API so that Qlik objects (charts, tables) can be loaded with client specific data.

We noticed incorrect data (data of all clients loaded) getting loaded in the Qlik objects during some scenarios, but this is not consistent. we can replicate this issue 3 -4 times out of 20 times which is quite annoying. Looks like the "CLIENT" id that gets passed to the API is not working for these error scenarios.

---------Code snippet---------

require(["js/qlik", 'jquery'], function (qlik, $) {
var app = qlik.openApp('8fbbb7d1-5cf7-4c8b-af57-03798e873555', config);
          
  app.field("CLIENT").unlock();
                app.field("CLIENT").selectMatch(ClientName, false);
                app.field("CLIENT").lock();
 
  function attach(elem) {
                    var appid = elem.dataset.qlikAppid;
                    var objid = elem.dataset.qlikObjid;
                    var app = qlikApps[appid];
                    if (!app) {
                        app = qlik.openApp(appid, config);
                        qlikApps[appid] = app;
                    }
                    app.getObject(elem, objid);
                    app.variable.setContent('vtop', '=(1+1)');
                    app.variable.setStringValue('vtop', 'if(((GetSelectedCount(Category)))=0,30,100)');
                }
                var elems = document.getElementsByClassName('qlik-embed');
                var ix = 0;
                for (; ix < elems.length; ++ix) {
                    attach(elems[ix]);
                }


----------------

1 Reply
Alexander_Thor
Employee
Employee

All of these methods, apart from `openApp()` are async. Usually they will complete so fast that they seem to be sync however under load and browser oddities you most like have a race condition here which is why you only see it sometimes.

Use the promises that return from each method to establish some flow control of your execution order.