In Qlikview we have the ability to add function to the scripting language by writing VbScript in the document module (sometime called the “macro module”). Typical additions included regular expression matching & parsing,
Qlik Sense does not have the module feature, but both Sense and QlikView share a similar feature, Server Side Extension (SSE). SSE is typically positioned as a method to leverage an external calculation engine such as R or Python from within Qlik script or charts. The Qlik OSS team has produced a number of SSE examples in various languages.
SSE seems to be a good fit for building the “extra” functions (such as regex) that I am missing in Sense. The same SSE can serve both Sense and QlikView.
Installing and managing a SSE takes some effort so I’m clear I don’t want to create a new SSE for every new small function addition. What I want is a general purpose SSE where I can easily add new function, similar to the way QlikView Components does for scripting.
Miralem Drek has created a package, qlik-sse, that makes for easy work of implementing an SSE using nodejs. What I’ve done is use qlik-sse to create qcb-qlik-sse, a general purpose SSE that allows functions to be written in javascript and added in a “plugin” fashion.
My motivating principles for qcb-qlik-sse:
- Customers set up the infrastructure — Qlik config & SSE task — once.
- Allow function authors to focus on creating function and not SSE details.
- Leverage community through a shared function repository.
I’ve implemented a number of functions already. You can see the current list here. Most of the functions thus far are string functions like RegexTest and HtmlExtract that I frequently have implemented in QlikView module or I’ve missed from other languages.
One of the more interesting functions I’ve implemented is CreateMeasure(), which allows you to create Master Measures from load script. This is a problem I’ve been thinking about for some time and qcb-qlik-sse seemed to be a natural place to implement.
If you want to give qcb-qlik-sse a try, download or clone the project. Nodejs 8+ is required. Some people report problems trying to install grpc using node 12, so if you are new to all this I recommend you install nodejs v10 instead of the latest v12.
If you are familiar with github and npm, you will hopefully find enough information in the readme(s) to get going. If not, here’s a quickstart.
- Install nodejs if not already present. To check the version of nodejs on your machine, type at a command prompt:
node --version
- Download and extract qcb-qlik-sse on the same machine as your Qlik desktop or server.
- From a command prompt in the qcb-qlik-sse-master directory install the dependent packages:
npm install
- Configure the SSE plugin in Qlik. Recommend prefix is QCB. If configuring in QlikView or Qlik Sense Desktop the ini statement will be:
SSEPlugin=QCB,localhost:50051
- Start the SSE:
./runserver.cmd
The “apps” folder in the distribution contains a sample qvf/qvw that exercises the functions.
I’d love to get your feedback and suggestions on usage or installation.
-Rob
wow, well done!
Outstanding! I was in the API track in DC last week and saw you were talking about the measure capabilities and was just about to email you to ask about it! I’ll certainly be digging into it tomorrow.
Good Work
Thanks for this Rob !
I am having trouble with running the server after install on Windows server (2016). I have tried multiple versions of node, npm etc.
Do you want detailed issues here or on git project ?
Thanks
Hi David,
I have the same problem with the executable on the server. Do you find a way to fix it?
Please post any problems on the issue tracker https://github.com/RobWunderlich/qcb-qlik-sse/issues
No unfortunately not. I will raise on GitHub project as advised by Rob.
Thanks
Hi Thanks,
Great job Robert, Any further issue I will post on the issue tracker,
P.D for me, it works installing the .exe with the http://nssm.cc/ on the windows server
Regards,
Hi Rob!
Any plans to include the new Qlik Sense Sept 2020 “Master Item number format” feature in the SSE?
I took a quick look at https://github.com/RobWunderlich/qcb-qlik-sse/blob/master/functions/qlik/CreateMeasure.js, but I’m not quite sure how to add a number format there.
Thx,
Roland
I had not planned to update the CreateMeasure() to handle any more properties. The other function CreateMeasureFromProperties() https://github.com/RobWunderlich/qcb-qlik-sse/blob/master/functions/qlik/CreateMeasureFromProperties.js can handle any measure property, so number format could be included there. To see what the input would look like, use the GetMeasures() function to load existing measures.
Hi Rob!
Thanks for your answer. I now had some time to play around with it on my Qlik Sense Sept 2020 Windows Server
The SSE seems to work fine:
– QCB.Reverse works fine
– QCB.GetDimensions work fine
-QCB.GetMeasures work fine
However the “Create” Functions do not work for me. The Dims and Measures do not show up in the Qlik Sense Frontend.
-QCB.CreateDimension
-QCB.CreateMeasure
-QCB.CreateMeasureFromProperties
The interesting thing is, if I now do a rerun of the script with GetDimension/GetMeasure I see all the dimensions/measures created via QCB. So it seems they arrived in the Qlik Sense App, but are not shown in the Master Items properties.
I will log you an issue on github. Would be great if you can take a look!
Thx,
Roland
Hi Ron! This is exactly what I was looking for, quick question: is there any way to update the metric after creating it? Does it uses the ID of the metric or the name?
it currently uses the Name to identify the measure.