Some of you may remember that I recently posted about a similar topic here When do you post to Facebook?, where I talked about creating an app that allows users to authenticate with Facebook, grab their data with Facebook APIs, use halyard.js to generate a load script, and then create a session app. But when I did this just a few months ago, one of the things I really wished I could do was use the Visualization API so I could simply create charts on the fly using Qlik Sense, but it wasn't possible then because a session app could not be created from or associated with the Capability APIs.

 

However, new APIs were introduced with Qlik Sense June 2017 that makes it possible to create apps on the fly using the Capability APIs, so now it is possible to create an app, load data, and create visualizations, all on the fly! This is made possible by the addition of some new methods to the Capability APIs, including the qlik.sessionApp method, the qlik.sessionAppFromApp method, the setScript method, and the getScript method.


There's already some pretty decent documentation for doing this at Qlik Sense Help - Creating apps on the fly, and I recommend you check that out, but I want to make everyone is aware of this very cool new capability of Qlik Sense June 2017, and just briefly address some issues you may run into.


First thing first, which is something I ran into while trying to create an example for this blog post -- anonymous users cannot create session apps, and this does not seem to be able to be controlled by security rules. Unless I'm missing something, it's entirely impossible. So, no anonymous users.


Next, there's been a few questions about just how to go about loading data. The simple answer is you need to set a load script using the setScript method, and then use the doReload method to load the data. But where do you get the load script from in the first place? Well you can use the getScript method on an app that already exists, or you can just write a script, though, of course, you'll need to also create the data connections you'll need somehow too if they don't already exist. And for many instances that I can think of where I would want to create an app on the fly, I'd use halyard.js. You could also create a session app from an existing app, get the load script from that app, and do some kind of search and replace on the load script which would custom tailor the data for the current user. The point is, there's a lot of possibilities, and it's really up to you and your use case how you want to go about this.

 

With being able to create apps, load scripts, and visualizations all on the fly, there's really a ton of potential to do some awesome stuff here. It would cool to hear about how some of you are using these capabilities!