Category Archives: Qlik Sense

QS Document Analyzer 1.3 Supports Server Apps

I just released the V1.3 update to Qlik Sense Document Analyzer.  Two significant features in this release:

  • The ability to analyze applications on the Enterprise Server.  You still install and execute QS Document analyzer on the Desktop,  but you don’t need to move the application to the Desktop.
  • The option to specify a Bookmark that should be applied before calculating objects.  This is particularly useful when an object has a calculation condition.

Another interesting update is that we are now validating all expressions and will flag any expression that has a syntax error.

You can download the latest version from the tools section of this site.

Thanks to Axis Group for their input on this release.  I’m looking forward to an ongoing collaboration.

You can report any issues with QS Document Analyzer in the issue tracker here.

Share

Expanding the Qlik Sense Editor Pane

Summary: In this post I present a non-intrusive bookmarklet to hide the Sections pane in the Qlik Sense Script Editor to provide more real estate for typing script. 

EditNote in the comments below that hiding the pane can be done out of the box using keyboard shortcuts such as Alt-F11.   That reminds me to read the doc! Nevertheless the concept of bookmarklets is useful and this post is bringing in some interesting contributions. 

I sometimes wish for a larger window in the Qlik Sense Script Editor where we type  statements.  This is especially true when I am projecting and I’ve zoomed my browser to make the text legible to the audience, or I’m saddled with a very low resolution.

The UI allows me to hide the Data Connections pane which provides  more space, but I’m still left with the Sections pane consuming 250 pixels on the left which may not serve me at the moment.

Wouldn’t it be great if I could hide/show the Sections pane on demand, like I can do with  Data Connections? Here’s a simple non-intrusive hack that will allow you to do just that.

Paste the following code in a bookmarklet. If you’re not familiar with bookmarklets, they are small bits of javascript code that can be executed from the bookmarks menu.  If you are using Chrome as I do, it’s as simple as pasting the javascript code in the URL property of a bookmark.  Google to learn more about bookmarklets.  If you are using a browser other than Chrome google to see how to create (if possible) bookmarklets in your browser.   Here’s the javascript:

javascript: (function () {
 var size = ($('.scripteditor-left').css("width") == "0px") ? "250px": "0px";
 $('.scripteditor-left').css("width", size);
 $('.scripteditor-stage').css("left", size);
 }());

Apply the bookmark and here is what the editor looks like now:

Apply the bookmark again and the Sections pane reappears.

 

This is an unsupported hack of Qlik Sense.  If something else does not work in the editor, you should refresh the browser — which will completely remove any effects of the bookmark — before suspecting or reporting that Qlik Sense has a defect.

This is  a very clean technique to add behavior because we have not modified any Qlik Sense files.

I file my QS bookmarklets in a Bookmarks Bar folder named “QS” which gives me easy access in a dropdown to mods I’ve created for Sense.

Here’s another bookmarklet I find useful.  This one opens the Qlik Sense script log folder for QS Desktop.  My userid in the path is hardcoded, you would of course update to the correct folder name for your machine.

file:///C:/Users/rob/Documents/Qlik/Sense/Log

Please share if you develop additional useful bookmarklets for Qlik Sense.

-Rob

 

Share

LET, SET, Quotes

Summary: In Qlik script SET is often a better choice than LET, even when the value contains quotes. 

I sometimes see the LET script statement used when SET would be syntactically  easier and more readable.

A brief review:  SET assigns the given parameter as-is to the variable,  LET treats the parameter as an expression and assigns the evaluated result to the variable.

SET x = 1+3;  // x is "1+3"

LET x = 1+3; // x is "4"

I frequently see a variable assignment like this:

LET eSales='sum(Sales)';

eSales stores an expression that will be used later in charts.  It could also be written (simpler in my estimation) as:

SET eSales=sum(Sales);

So far just a matter of style, but the difference becomes clear when we have quotes as part of the string, for example, “Region={‘US’}”.   As LET requires a quoted string,  embedded quotes require some sort of escaping.  In QV10 and earlier, a common way to write this with LET would be:

LET x = 'Region={' & chr(39) & 'US' & '}';

Not real pretty. Many people carry over this style even though QV11 introduced two single quotes to represent an embedded single quote.

LET x = 'Region={''US''}';

Easier to read for sure.  But I think it’s even easier with SET.

SET x = Region={'US'};

That’s it. No special escaping required, just type it as it should be.  What about those quotes? Shouldn’t SET strings be enclosed in quotes?

I find the documentation on SET to be thin, but here is the rule as I understand it.

Single or Double quotes in a SET statement require no special treatment as long as they are balanced (even number of quotes).

SET x = Region={'US'},Product={'Shoe'};  // Valid

SET x = Region={"U*"},Product={'Shoe'}; // Valid

SET x = I won't go;   // Invalid

If the quotes are unbalanced (odd number), then the entire string needs to be enclosed in quotes or brackets.  Use double quotes if we are enclosing single quotes.

SET x = "I won't go";

SET x = [I won't go];

I always favor SET over LET unless I truly want an evaluation.  An exception to this is the string “$(” which will trigger an Dollar Sign Expansion, even in SET.

-Rob

For more on character escaping in Qlik from HIC see https://community.qlik.com/blogs/qlikviewdesignblog/2015/06/08/escape-sequences

Share

Hiding Mashup Objects

I’m really appreciating the Qlik Sense Mashup facility.  In the simplest case, mashups are when you embed Sense charts in a web page.  Super easy with Sense.

Perhaps you’ve created some charts in your app that exist solely to serve the mashup.  What if  you want to display these charts in the mashup but you don’t want them showing in a sheet when the app is viewed via the hub?

How to make these charts available to the mashup but not appear in the “app”?  Simple.   After creating the chart, make it a Master Visualization and then delete it from the sheet.  The mashup can use the Master Viz Id to reference the object.

If you are using the Dev Hub Mashup editor, note that Master Visualizations appear at the top of the “Sheets and Objects” list, before the first Sheet.

 

 

 

 

 

 

 

 

-Rob

Share

DevTool Extension for Qlik Sense

One of the benefits of attending the Masters Summit for Qlik is networking and the things you can learn from discussions with peers.

At the Boston Summit, I was fortunate to meet Erik Wetterberg, formerly of Qlik R&D and known to me as the author of the qsVariable and DevTool extensions.  I’ve been a fan of the DevTool extension for some time and had a nice chat with Erik about potential enhancements to DevTool.   Since the summit Erik has made some updates and accepted new function I’ve added to the tool.

DevTool provides some functions that are useful during Qlik Sense app development and debugging.  Download the DevTool zip from the dist folder here https://github.com/erikwett/DevTool and install as you would any other extension.

Add  the extension to any sheet and it will create an Action Button (AB) to the lower right corner of the sheet.

You don’t have to leave the extension in the app, the AB will remain until you close the app.  I usually don’t leave it in the app, I just add it and then remove by double clicking DevTool in the assets panel and follow that with a Ctrl-z undo.

You can leave it in the app if you wish.  There are some considerations discussed below for leaving it in a published app.

Clicking the AB will toggle a tooltip above each sheet object that initially displays the objectid.  The objectid is useful when building mashups or reviewing diagnostic data.   As selections are made and the objects are recalculated, the tooltip will add a line showing the time in milliseconds for the current calculation as well as the max calculation time for this object.

 

Click the “properties” button on the tooltip and this object’s json formatted properties will display in a popup.  Use the copy-to-clipboard button to copy all or selected property lines to the clipboard.

Right-Click the AB to open a context menu that provides for:

  • Exporting script to a text file.
  • Importing (replacing) script from a text file.
  • Exporting variables in script or json format.

The extension works equally well in desktop or server.  Some things to think about before including it in a published app.

  • Users normally can’t see the load script and variables in a published app, but they can with this extension.
  • Although the script import works without error in a published app, the change to script is not saved so effectively nothing has been updated.

For myself, I’ve been thinking of this as a tool to use during development only and have not been including it in published apps.  I’d be curious to hear if someone has made a different decision.

The extension buttons use a google font. I note that many servers are blocked from the internet. If this is your case, you will see red dots for the buttons instead of proper symbols.  The buttons are still fully functional.

Maybe I’ll see you at the Masters Summit in Prague  where you might find your own interesting collaboration.

-Rob

Share

Quick Sense App in a Page

Summary: Learn an easy method to deliver a Qlik Sense app as an embedded web page. Yes, the spelling of this post’s title is intentional 😉

I just came off a week of Qlik Sense API & Integration training with Nick Webster of Websy.  I’ve been nothing short of impressed with the integration and reuse options of Qlik Sense.

I was intrigued today by a question on Qlik Community asking if there was a way to disallow the application Edit mode in Qlik Sense Desktop.  The poster wanted his students to just “use” an app and not poke around in the design until a later time.  Kind of like the “distraction free” mode  in text editors.

The challenge I gave myself was how quickly could I knock out a solution to this problem?  I’ll detail my solution below and I’ll tell you it is taking me longer to write this blog post than it took to build the solution.

Rather than working at disabling or removing function I didn’t want, I approached the problem as including only what I wanted. My first thought was to create a mashup that represented the entire application.  Then I struck on an even easier approach — use the Qlik Sense “Single Integration API” with a bit of Bootstrap.   The Single Integration API does not require writing any code.  It’s just a URL that displays a single Visualization or complete Sheet.  You can create URLs and experiment with options in the Dev Hub Single Configuration Tool.

Bootstrap is a popular web design toolkit that makes it easier to create responsive and interactive web pages.  Thanks to Nick’s class I understood how Qlik utilizes bootstrap.

A basic URL to display a sheet looks like this:

http://server/single/?appid=myappid&sheet=sheetId&opt=options

Appid is a qvf filename on QS Desktop, or the GUID if using QS Server.  Options allow you to control  things like allowing selections.  A complete list is in the API doc.

With 50 lines of html I created a web page that delivers the full associative experience across seven sheets, including Current selections, Smart search and the Selections tool.

Here’s a screenshot showing my sheet navigation buttons across the top and the Sheet content, including Current selections, immediately below the buttons.

The html file is available for download here.  I used the “Sales Discovery” sample app but it is easy to adapt the file to any application.

There is a single iframe nested in a responsive Bootstrap container.  The buttons simply change the src attibute of the iframe to load a specific sheet .

If you want to try the file yourself you  only need to change the “var appid=” string to point to the app path on your machine.  No web server is required, just double click the html file to launch.  Your server or QS Desktop must be active.  Yes, this file works as is with QS Server.

Nick and I will be showcasing a variety of QS integrations at the Masters Summit for Qlik in Boston Oct 23-25.   Nick will also be presenting  a half day “Qlik Sense Integration” session at the summit that will teach you how to create a basic web page with bootstrap and explore more advanced QS integration options.

-Rob

 

Share

Web Dev for Qlik Devs Course in San Francisco

In January I attended (review) Nick Webster’s  “Web Development for Qlik Developers” course.  I found the course extremely valuable so I’m bringing Nick  to San Francisco September 19-22 for a four day fast track course.

Are you a Qlik Sense Developer that wants to understand how to use the various QS APIs to create your own mashups,  portal integrations or custom content pages that leverage data from Qlik Sense?  Do you want to create your own QS Visualization Extensions or modify existing extensions?

In this four day hands on course you’ll learn:

  • The fundamentals of HTML/Javascript/CSS as they apply to QS Development and how to get started with some  popular frameworks and libraries.
  • Creating Visualization Extensions.
  • The differences and application of the various QS APIs e.g. Capability, Visualization, Engine.
  • Important QS core concepts such as the generic object model.
  • Connecting to the QIX engine to retrieve existing content or generate associative aggregations (hypercubes) on the fly.
  • Visualizing data using third party libraries.

You’ll come away with example code and your own completed exercises giving you the confidence to move ahead on your own.

No prior experience with web programming is required as the course will provide an intro to those technologies and how they are used in Qlik Sense Web Development.

Course fee, location and registration here.   Don’t wait, as the class is limited to 10 students!

-Rob

 

Share

QlikView to Qlik Sense Convertor

Are you migrating QlikView Apps to Qlik Sense?  Have you tried the new QlikView Convertor tool in QS 3.2? 

The QV Convertor tool is available from the Dev Hub in QS 3.2+.  It’s a pretty slick tool that converts QV Variables, Dimensions and Expressions to Master items and converts QV charts to Master QS Visualizations.  It does not attempt to replicate the sheets,  but expects you to place the visualizations on sheets yourself as required.

It’s a very useful tool with a good UI that allows for filtering and limiting what gets converted.

At the Atlanta Qlik Dev Group meeting on July 13 I’ll be demonstrating the tool and presenting some tips and considerations for doing conversions.   They’ve given me two hours (!) to speak so I’ll be covering several other topics as well.

-Rob

Share

Sense Alternate States, Please

When I started with QlikView (V7), we sometimes wanted to operate on data other than the current selections.  We accomplished this with the ALL keyword and complex if() functions.  It usually did the job but slow, resource intensive and frequently complex to code.

Along came Set Analysis in QV8.5. Brilliant! Performance problem solved!

We still wanted to do comparative analysis, something not directly supported by Set Analysis.  So we resorted to loading fields a second time in a data island.  Once again, slow, complex if() functions.

Along came the Alternate States feature in QV11. Brilliant! Performance problem solved!

The Qlik Sense client does not yet support Alternate States.  We know the backend QIX engine supports Alternate States,  but accessing the feature outside the client  is beyond the reach of most QS Developers.

Now going “back to the future”, we see very smart QS developers creating patterns for doing comparative analysis in QS using data islands.

It’s good work.  But it’s coding gymnastics.  Data islands come at a cost, inflating and complicating the data model and consuming additional server Cache and CPU.

So here is my pitch to the QS Product Team at Qlik:  We know that data islands can be a performance pitfall.  We’ve seen the problem and the solution  in QlikView.  Can we skip the “adversity will make you stronger and smarter” phase and just expose Alternate States in the QS Client?  Now please?

-Rob

Share

A Journey to My First Published Extension

Like Karl Pover, I’m curious to learn more about writing Qlik Sense extensions and other opportunities to use the Sense APIs.   I’ve created some throwaway examples in class, usually working directly in the Sense/Extensions directory.

I found I reached the point where I wanted to get a bit more serious about the mechanics of writing and maintaining Sense code. This post discusses some of my journey in discovering and implementing a structure for writing and publishing Qlik Sense extensions. (For tutorials on writing the actual extension code see Qlik Help or websy.io)

First, my extension project.  I like the script export/import function in QlikView script editor and have missed this function in Sense.  So I created a extension that provides buttons to Export and Import script to text files.

 

 

 

 

Yes, it’s true — a “Visualization Extension” that visualizes nothing.

You can click “Export Script” to send the current script to a text file, and “Import Script”  to replace the current script from a text file of your choosing. You can also drop a text file on the Import button.  You can find the extension with download links here.

On to the focus of this post, which is “how-to”.

Naming Conventions

As the extension landscape expands, how many extensions named “Super Bar Chart” will be created and published on GitHub? We need a naming convention that allows everyone to co-exist and avoid collisions.  I adopted the common open-source naming convention of prefixing assets with my reversed domain name “com.qlikcookbook”.   So the formal name of my extension is:

com-qlikcookbook-ExportScript

All my files; js, css, etc are prefixed with this namespace prefix. The “name:” property of the required .qext file provides a friendly name that will display in the Assets panel.  I chose the shorter “Export/Import Script” for the name.

An extension lives inside a larger application and must play well and share with others.  It’s not a good idea to name your html Div “output” as you may collide with others who use the same name.  I used the same prefix for any elements that may have a scope outside my extension, specifically html ids and css class names. The Qlik Help has some recommendations on this topic.

Directory Structure

I looked a a number of different directory structures on github that other folks had used for existing extensions.  I settled on the layout recommended by Stefan Walther in the documentation for his sense-go tool.  The design made sense and I was also interested in using the sense-go tool for building.

Loading External Libraries

I used a couple of external libraries in the project to handle the file download and the drag&drop function. Instead of referencing those libraries with html links, I learned how to use require.js, an integral tool in the coding patterns of Qlik Sense.  I also  used require.js to load my css and html files. It’s a great tool.

Building and Deploying

The standard way of writing code is to write your source code in one location and then prep and package the files into an installation or runtime bundle.  There are many advantages to following this pattern.  We also want a way to automatically redeploy the updated code to the Sense desktop or Server for testing, and upload a release package when ready.   As a starter build & deploy process, I chose Stefan Walther’s sense-go tool.  In addition to automating the process, I found  the task chain to be a good knowledge transfer from an experienced Sense developer.

Other Tools

Everyone has a favorite editor, I tried a few on this project.  I found I liked vscode best.

For managing the git repository,  I used GitHub Desktop.  You may like another tool or be a command line fan.

If you are starting out writing extensions, I hope these notes help give you some direction.

Note; This extension has been deprecated in favor of the DevTool extension which provides the same functionality and more. 

Share