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

QV12 Variables with Alt State Fixed

Summary:  QV11 contained an inconsistency in how variables with equal signs were evaluated when using Alternate States.  This has been fixed in QV12.10.  Read on if you want the details. 

QlikView V12.10 includes an important fix to variable evaluation when using alternate states. A quote from the Release Notes:

In QV11.20 the variable was expanded in the first state encountered and this resulted in a random behavior when more than one alternate state was being used. Whereas in version 12 and up, the variable always belongs to a specific alternate state and this results in different behavior.

The random behavior described in QV11.20 has generated several interesting posts to QlikCommunity with responses¬†of “I can reproduce” / “I can’t reproduce” and¬†few clear answers.

I find the problem confusing and interesting enough to warrant an explanation and example beyond the Release Note.

What I am describing¬†in this post only affects variables with a leading “=” in the definition, e.g. “=Sum(Sales)”. ¬†These variables are calculated once in the context of the entire document. They are not calculated per row in a chart.

Let’s consider a variable named “vSumX” with a definition of “=Sum(X)”. ¬†The expression simply sums all selected values of X. ¬† Suppose we have two States in our document — “Default” and “State1”. ¬†There could be two different selections for “X”. ¬†Which set of X should the variable sum?

If we consider the variable definition in isolation, the answer is “Default set” ¬†as there is no set identifier in the expression. ¬†But what if the variable is referenced in an object in State1. ¬†Should the State1 values of X be used?

No matter what you think the rules should be, here’s what was happening in QV11.20. ¬†The variable was expanded (evaluated)¬†in the first state encountered. ¬†First state encountered means first state in the calculation chain, not something the developer directly controls.

Let’s look at some examples. ¬† I’ve created a sample app (you can download here) with three States — Default, ¬†State1 and State2. ¬†The variable “vSumX” is defined as “=Sum(X)”.

With all objects on sheet in the Default state, selections in X would yield results like this. ¬†(Note “$” indicates default state).

The first text box contains the expression “Sum(X)”. ¬†The second text object contains the reference to variable vSumX. ¬†The two values are what we might expect, summing the selected values of X in this state.

Let’s switch to a sheet that contains objects in the state named “State1”.

No selections in X and the first text object shows the expected result. ¬†The second object shows the value of vSumX as previously calculated from the default state. ¬†If we make selections on this State1 sheet, that will cause vSumX to be recalculated and both State1 and the Default sheet will reflect the State 1 number. ¬†Is that correct? ¬†Is it useful? ¬†It’s at least consistent and comprehensible.

My next example is where the aforementioned “random” comes into play. ¬†Let’s put objects from three states on the same sheet.

I’ve selected some values in the Default state of X and the results are what I might expect. ¬†The value of vSumX is calculated from my last selections and the variable value is consistent across objects — there is only ever one value for a variable at a given point in time.

Now I select some X values in State1 and expect to see a new value (19) for vSumX.  But no change! The variable was expanded (evaluated) in the first state encountered which happened to be Default ($).

Now I select some X values in State2.  If the vSumX calc used my last selection I would expect to see 7.  But no, I see 19.  The State1 values were used.  If I repeat the exercise, it may use a different state to calc vSumX.  If you test you may get different results.  In this last example, State1 was used because it was the first state encountered in the calculation chain.  The order is not consistent.  It will be influenced by factors such as number of available processors and the order in which the objects were created.

Now that we’ve established that QV11,20 is broken in this regard, how was it fixed in QV12.10? ¬†Simple. ¬†QV12 uses ¬†set identifiers as specified in the expression, without inheritance.

=Sum(X)

will use the Default State as there is no identifier.   If you want to Sum from a specific state, use it in the expression:

=Sum({State1} X)

Variables do not belong to any State. ¬†Aggregation functions used in a variable may specify a Statename, just as chart expression do. ¬†The difference is that the absence of a set identifier in a chart expression means “inherit the state from the containing object”. ¬†In a “=” variable, no set identifier means “use the default state”.

A reminder that end of standard support for QV11 comes on Dec 8, 2017. ¬†If you haven’t yet upgraded to QV12.10, I encourage you to do so. ¬†Download my¬†¬†QV12 Upgrade Considerations Doc as part of your planning process. ¬†Feel free to contact me if you want some assistance with your upgrade.

-Rob

Update:  Qlik has extended support for QV11.20 to March 31, 2018. 

Share

Document Analyzer Batch Analysis

I’ve received several requests to provide a batch interface to the popular QV Document Analyzer tool that will provide for analyzing multiple QVWs with a single command. ¬†It’s now available for download here.

The script is a windows cmd file. ¬†Because many browsers block download of cmd files, I’ve provided it with a “txt” extension. Rename to “DABatch.cmd” after downloading.

The usage from the command line is:

DaBatch.cmd somedir
¬†where “somedir” is a directory of QVWs to be analyzed. ¬† Each QVW in the directory will be processed by Document Analyzer and the results will be saved for later review.
Before running, there are a number of configuration variables in DABatch.cmd you will want to review and modify as necessary.

 

REM *** Path to QV.exe executable ***

SET qvDir=C:\Program Files\QlikView\Qv.exe

This is location of the QV Desktop executable. The provided value is the default location for most users and is typically appropriate as-is.

REM *** Path to DocumentAnalyzer.qvw. Note that v3.6 or later is required! ***

SET DaPath=DocumentAnalyzer_V3.6.qvw
Where is the Document Analyzer.qvw to be found?  Note that DA V3.6 or later is required by DABatch.

 

REM *** Directory to store DocumentAnalyzerResults QVDs and QVWs. Will be created if it doesn't exist *** SET DaResultsDir=C:\temp\MyDaResults
Specify the directory where analysis results will be saved.  If this directory does not exist, it will be created.

 

REM *** Should the analyzer results be stored in a QVD (YES/NO)? ***
SET SaveResultsInQVD=YES
Do you want to save the DA results in a QVD for later analysis by the¬†DaCompareTool.qvw? ¬†The default of “YES” is usually appropriate here. ¬†¬†QVD result files include a timestamp so you will always get new files for each run. Change to “NO” if you don’t want result QVDs.

 

REM *** Should the analyzer results be stored in a QVW (YES/NO)? ***

SET SaveResultsInQVW=YES
If “YES”, a DA QVW will be saved for each analysis and named “DocumentAnalyzer_your_qvwname.qvw”. ¬†If a file exists with this name, it will be overwritten. If you don’t want individual DA QVWs, change this variable to “NO”.

 

After launching DABatch, you will receive one prompt:
Analysis Title? <ENTER> for 'Baseline'
The prompt is requesting¬†a title to be assigned to the Result QVDs that will be consumed by DaCompareTool. ¬†To accept the default of “Baseline”, ¬†press <Enter>. ¬†Otherwise type a new value and press <Enter>.


If you have set “SET SaveResultsInQVD=NO” as a configuration option, the title value is irrelevant. ¬†(Perhaps I should not prompt in that case; next version?).


While the script is running Document Analyzer windows will be launched for each QVW and progress message displayed. ¬†It’s best to keep your hands off the keyboard to get proper timings. ¬†Good time to get that coffee.

When execution is complete you’ll see a summary message.
*****************************************************
Batch Analysis complete. 3 QVWs analyzed.
*****************************************************


You can now review each”DocumentAnalyzer_your_qvwname.qvw” file or load the result QVDs into¬†DaCompareTool.qvw for comparative analysis.


Please let me know in the comments section if you can think of enhancements that support your use case for DA batch analysis.


-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

QV12 REM Logging Change

Summary: QV12 no longer prints the REM statement to the Document Log.

In QV11 “//” and “/*” comments do not appear in the Document Log, but “REM” comments do appear in the log. ¬†I found REM useful to provide some documentation in my logfile or record¬†which branch was taken in an IF-THEN-ELSE.

QV12 has changed the logging of REM.  The REM statement will now appear in the log obfuscated as a series of asterisks  For example, the statement

REM  Beginning of weekly load;

will appear in the log as

2017-05-18 14:24:34 0005 *** *** ******

My understanding is that the change was made to support security standards, as someone could REM a CONNECT string or other sensitive data thereby exposing it in the log.

To provide log documentation, use the TRACE statement instead. ¬†I don’t find TRACE as pretty as REM because TRACE generates double lines, but it will do the job.

I maintain a collection of upgrade notes for QV12 that you can download here¬†to assist in your planning. ¬†Please do read all the Qlik doc — release notes and help site — as well.

-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

Guest Speakers for Boston Masters Summit

 

I’m pleased to announce our guest speakers for the upcoming ¬†Boston¬†Masters Summit for Qlik ,¬†October 23-25

Anthony Deighton, Qlik CTO, will be our evening speaker. ¬†Since 2005¬†Anthony has been¬†responsible for guiding product strategy and leading all aspects of the company‚Äôs R&D efforts. ¬†Anthony’s talk is sure to be interesting, stimulating and informative.

Nick Webster’s¬†evening talk at the Munich summit was such a hit that we’re bringing him back in an expanded role. ¬†Nick will present a half day, hands-on session titled “Qlik Sense Integration”.

Want to understand the possibilities of the web and the Qlik platform? ¬†Nick’s¬†¬†session will help you understand the basics of HTML and CSS and show you how to construct a basic web page that displays data from Qlik Sense.¬†¬†After completing the session you‚Äôll have a fully functional, interactive web application and the inspiration to continue your journey into the world of web development with Sense. ¬†No prior experience with Web Development or Qlik Sense is required.

Those special speakers are in addition to our already packed three day agenda.

I hope to see you in Boston!

Learn more about the Summit or register for Boston.

 

-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.

Share

Boston Masters Summit

The next  Masters Summit for Qlik event will be in Boston on October 23-15, 2017.

Designed for Qlik Developers who have basic skills and experience,  the Summit presents three days of intense hands-on sessions in topics such as Advanced Scripting, Data Modeling, Advanced Aggregation and Set Analysis, and Visualization Techniques, applicable to both QlikView and Qlik Sense.

You have some experience with Qlik, have taken the beginning courses. How do you ramp up to create more success with your Qlik program? Learn from seasoned experts, authors and world class presenters Rob Wunderlich, Barry Harmsen, Oleg Troyansky and Bill Lay.

In addition to the hands-on exercises, you’ll come away with many valuable sample files and documents. You’ll also get a chance to meet and network with Qlik Developers from around the world.

Our 2017 program features an expanded Performance Tuning section and additional content specific to Qlik Sense.

In four years over 900 Qlik Developers have attended twelve Summits around the world. Their feedback is overwhelming positive. Read about their experience here.

I hope you can join us in Boston to take your Qlik skills to the next level! Read about the details of registration here.

-Rob

Share

Recipes for Qlikview Success