This is the multi-page printable view of this section. Click here to print.
Sense apps that explain and highlight various Butler features
Butler comes with several demo apps.
Feel free to review them to get a better understanding of how Butler can be used.
- 1: Using Butler APIs from Sense load script
- 2: Partial loads in Qlik Sense
- 3: Post message to Slack
- 4: Publish message to MQTT
1 - Using Butler APIs from Sense load script
This app uses the helper subs call some of Butler’s APIs. It’s not diving too deep into any particular feature, but rather just calls most APIs to show how it’s done.
If unsure what the parameters of the helper subs should look like, this page might be useful.
Calling the Butler API from Sense app’s load script
The demo app Butler 5.0 - demo app.qvf
is available in the GitHub repository.
The app includes examples on how to use many of Butler’s REST APIs endpoints.
It doesn’t have much of a user interface (it just shows what API endpoints are enabled) so you should look at the load script to get examples of how to use the Butler APIs.
The app includes a copy of the helper functions that are also available in the GitHub repository.
2 - Partial loads in Qlik Sense
It’s surprisingly difficult to do partial loads in Qlik Sense Enterprise on Windows.
In QlikView that feature was easily available, but in QSEoW it’s currently not possible to create reload tasks that do partial app reloads.
Butler has an API for doing partial reloads of apps. A couple of demo apps are also includedin the GitHub repository.
Partial reload API
The full API documentation is available in the Reference section, here we’re interested in the PUT /v4/app/{appId}/reload
endpoint.
Demo apps for partial reloads
A couple of apps showing how to use Butler’s partial load API are included in the GitHub repository.
- The first app’s load script uses the Butler API to do full and partial reloads of the second app.
- The second app loads 10 rows of data during a full reload and 5 rows during a partial reload.
Video showing how to use demo apps
Available at Ptarmigan Labs’ YouTube channel and also in the Butler YouTube playlist.
3 - Post message to Slack
Load script
Assuming the .qvs helper subs are used, only one line of script is needed to send a Slack message:
// -------------------------------------------
// Post messsage to Slack
// -------------------------------------------
// Post a basic message to Slack
Call PostToSlack('#general', 'Butler the Bot', '👽 Greetings, we come in peace.' , ':ghost:')
Note how emojis can be used in the message and a message specific icon can be used (":ghost:" above).
The Slack message looks like this:
The demo app is available in the GitHub repository.
4 - Publish message to MQTT
Load script
Assuming the .qvs helper subs are used, only one line of script is needed to publish a MQTT message.
The demo app does a bit more. First it posts a startup message to MQTT, then it loads some data and finally an all-done message is sent:
// -------------------------------------------
// Publish a MQTT message, load some data and publish another message
Call PostToMQTT('butler/5.0/demo-reloading/status', 'reload started')
// Load some data
Characters:
Load Chr(RecNo()+Ord('A')-1) as Alpha, RecNo() as Num autogenerate 26;
// Publish final message
Call PostToMQTT('butler/5.0/demo-reloading/status', 'reload done')
The MQTT messages look like this in the MQTT Explorer app on mac OS:
The demo app is available in the GitHub repository.
Seeing is believing
The video below is available at Ptarmigan Labs’ YouTube channel and also in the Butler playlist.