Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
Jennell_McIntire
Employee
Employee

Have you ever used a Binary statement in your script or done a “binary load” as folks familiar with Qlik scripting may say?  The Binary statement can be used in both QlikView and Qlik Sense scripts to load data from another QlikView document or Qlik Sense app.  When using QlikView, the Binary statement can only be used to load another QlikView document.  When using Qlik Sense, the Binary statement can be used to load another Qlik Sense app or a QlikView 11.2 or earlier document.  Note that you cannot use a Binary statement in a QlikView script to load a Qlik Sense app.  The Binary statement will load not only the data but the section access data as well.  It does not load variables or any layout information such as charts, sheets or stories from the app or document.

 

The Binary statement is helpful when you want to use the data model from an existing app or document in a new app or document.  Instead of copying the app/document and then deleting the sheets, stories, etc., you can create a new app/document and load just the data using the Binary statement.  Then you have a fresh slate to build out the sheets and visualizations.  Chuck Bannon wrote a blog on ways you can extract data from a document which you may find useful.  In his blog, he uses the Binary statement to get the data from another document and then he stores the data into QVDs.  I personally prefer the second option he discusses that uses a for loop to create the QVDs.  Storing the data into QVDs is useful if you need to manipulate the data when loading it.

 

There is one thing you must remember to do when using the Binary statement in order for it to work – you must make the Binary statement the first statement in the script.  This means adding it before the Set statements.  The syntax varies for QlikView and Qlik Sense so let’s take a look at both.

 

In QlikView, either statement below can be used.  In the first example, the MyApp document will need to be in the working directory otherwise the absolute file path will need to be included as seen in the second example.

QV1.png

QV2.png

In Qlik Sense, you will need to create a folder connection to the app you would like the use.  In the example below Demo Apps is the folder connection I created to access the MyApp QVF.

QS1.png

Simple, right?  The Binary statement when loaded as the first statement in the script will load the data from another QlikView document or Qlik Sense app providing you with the same data model as the original app and a clean slate to build out your visualizations.  Good luck scripting!

 

Jennell

12 Comments
tmackay2015
Partner - Contributor III
Partner - Contributor III

I have always regarded the binary load statement rather negatively.

firstly because you can only "binary load" one qvw/qvf , but from a more practical standpoint i find its use to be a bad practice as it locks the development team in to waiting instead of doing, and sets you up for potential of cascading failures.

The typical use case I have seen is abstracting the data model from the UI, perhaps supporting several UI apps from one data model app. or perhaps simply to divide the data-model domain and ui domain responsibility between  two individuals.

I have seen this done then typically the apps mutate and there are bits loaded on afterwards for some and not others and then the data model grows to be this horrible unwieldy snowflake model that gets trimmed after the UI load.

One script error at the lower level then kills the reload of all related apps...

<sarcasm> good job systems architect. </sarcasm>

however per chuck bannons post.  Exporting all the tables down to a set of qvd's seems like  a far more appropriate solution, and with either some clever folder partitioning or by clever table naming

the ui load statement is

load * from [path\*.qvd] (qvd);

Where additional loads from different paths for separate chunks of the data model are necessary or altering the  wildmatch string with keywords stored in the filenames changes the scope or level of detail

eg  --> [path\*summary.qvd]

I have done the experiment and the speed of load for binary cannot be beat but qvd optimized load comes very very close, the difference is that the loading of individual qvd's does not include the internal relations between tables already built out at the end of load statements. and as you can guess any additional modifications to the data model after a binary load pretty much renders that advantage moot as the internal relations have to be rebuilt...

Additionally if you have a development change to a single table, you need only remake that qvd in a minute then perform the reload on the UI to see the changes instead of redoing all of the transforms on all of the data in the app and waiting around for perhaps 20 minutes for that to complete, then reloading on the ui app to see if the change went through properly.

Some niche developer apps i have made do use the binary statement  as a way to hack the data out of an existing app but from a general production and development use, it is probably best to avoid in favor of more flexible options.

-Tom

0 Likes
718 Views
Anonymous
Not applicable

I have found binary loading a QlikView qvw's data model into a Qlik Sense qvf very useful for trialling Qlik Sense, as one can quickly get a data model into Qlik Sense and then look at the front end visualization possibilities / challenges.

It is the front end that differs most View vs. Sense and needs the most attention / trialling, so this gives the quickest route to starting on the front end..

718 Views