Qlik Community

Ask a Question

Suggest an Idea

Vote for your favorite Qlik product ideas and add your own suggestions.

Announcements
QlikWorld Online 2021, May 10-12: Our Free, Virtual, Global Event REGISTER TODAY

Sense Task parameter passing

mcilwricka
Luminary
Luminary

Sense Task parameter passing

QlikView QMC allows you to create tasks with parameters that are passed into script variables - this should also be possible in Qlik Sense task.

5 Comments
sergio_loza
Partner
Partner

I second this. It apparently was available in Qlik View. It would make things so much better

rva_heldendaten
Partner
Partner

Totally agree! Just for those who don't remember QlikView - here's how this feature looks like:

 

rva_heldendaten_1-1600783942937.png

 

 

mountaindude
Luminary
Luminary

Yeah I totally agree.

I would think this will arrive sooner or later in the core Qlik Sense Enterprise product, but not wanting to wait I created an alternate solution for this.
It solves my needs in this space but there are of course room for improvement too.

The solution is built around a generic key-value store, which is included in recent versions of the open source Butler service (butler.ptarmiganlabs.com).

The idea is pretty simple:

  • You first insert into the key-value store whatever parameters you want to pass to a an app's load script. This is done by calling Butler's REST API, either using some 3rd party tool outside of Sense (database, upstream data source, Powershell etc) or from another Sense app using a "Call AddKeyValue()" call.
  • The second app then reads the keys where parameters are stored, and voila - we have parameter passing between apps as well as from outside world into an app.

 

Like this:

mountaindude_0-1612359313099.png

True, you will have to set up and run Butler for this to work. But it's open source (free) and runs nicely even on the existing Sense servers. You also need to add some script lines for inserting the parameters, but it's literally just a few lines of script:


Write values to key-value store from the first app...

// Create key-value pair in Butler's key-value store. 

Call NiceTrace('---------------------------')
Call NiceTrace('Writing parameter to Butler key-value store. No time-to-live (ttl).')
Call AddKeyValue('Reload chain parameter demo', 'Parameter 1', 'a1 abc 123', 0)

Call NiceTrace('Written parameter to key-value store: ')
Call NiceTrace('Namespace="Reload chain parameter demo", Key="Parameter 1", Value="a1 abc 123"')

 

...then read them back from the second app

// Define variable to store the retrieved parameter in
let vParam1='';

Call NiceTrace('---------------------------')
Call NiceTrace('Loading parameter from Butler key-value store.')
Call GetKeyValue('Reload chain parameter demo', 'Parameter 1', 'vParam1')

Call NiceTrace('Retrieved parameter value:')
Call NiceTrace('Namespace="Reload chain parameter demo", Key="Parameter 1", Value="$(vParam1)"')
set vParam1=;

 

Works quite well.

jonas_viklund
Contributor II
Contributor II

yes, this would be a great feature.

kuba_michalik1
Contributor II
Contributor II

Yeah, this is needed.

Every single workaround I saw so far (including the suggestion for Butler above) has one fatal flaw: they are scoped to the app, not to the task. There is just no way to have 1 app

So if previously you had 1 app and a task that was spitting out 10 versions based on a parameter with 10 values, or 1 app with multiple tasks specified and parametrized differently, suddenly you need 10 apps. If all the app was doing was data processing, then it's not so bad, you can minimize repetition of script via includes. If the app had actual visualizations in it... ouch.