Qlik Community

Qlik Design Blog

All about product and Qlik solutions: scripting, data modeling, visual design, extensions, best practices, etc.

Employee
Employee

Binary Statement

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

Hello Jennel. How can you use binary load on the server?

0 Likes
352 Views
Partner
Partner

Unfortunately BINARY Load in Qlik Sense Server is not supported.

As in Qlik Sense Server each .qvf is simply a GUID, the syntax is similar to:

BINARY 1b605a19-bdd1-4313-8168-bdce11e672ad;


Actually this works, but it as discussed in support case 00962588 - Is BINARY Load of Qlik Sense Server Apps supported in Qlik Sense Server? one should not use it in Qlik Sense Server.


Very sad, as it would be a super important feature to seperate Developers from Designers.

352 Views
Luminary
Luminary

Thank you Jennel for an informative post.

alex.nerush‌, rva_heldendaten‌ I am actually using this solution without issues:

Qlik Sense: Secured binary loads

352 Views
Partner
Partner

NIce, but unfortunately unsupported! See the Qlik Support Knowledge Base article below.

For my customers it would be a hugh improvement to get BINARY in Qlik Sense. But as long as it is an unsupported feature, we can't really rely on it.

352 Views
Partner
Partner

Hi Roland,

I don't know how big are your apps, but the only issues I've had until now are:

  • binary "hangs": on QS 2.x you had to close the DataModel application (or generically the application from which you are doing the binary) and then you could do the binary. With QS > 3.x this doesn't happen anymore
  • binary doesn't work: if you are reloading the DataModel application and try to do the binary, the binary shouldn't work

So yeah, probably this feature is currently unsupported, but I haven't faced any other issue...

Possibly, if you are using the Synchronized persistence (which will be deprecated since QS 4.x, as mentioned in the Release Notes of QS 3.2) the synchronization of the data between repositories is an extra issue to face... Unluckily I don't have experience with Synchronized persistence

P.S. For those wondering: in QS Server you can do the binary without specifying the Apps folder if you're using the Legacy Mode (so you'll really have a simple "Binary (guid);" instruction)

0 Likes
352 Views
Partner
Partner

One bit of maybe useful information, which might not be obvious - it's ok to have Binary statement inside an $(Include) / $(Must_include) variable. It still has to be the first statement in the script after all includes are resolved.

0 Likes
352 Views
Employee
Employee

Also it must be highlighted that you can edit the Section Access that is loaded during a binary load.

0 Likes
352 Views
Partner
Partner

HI Riccardo!

Thanks for your info! We have made some bad experience using unsupported/(borderline-supported) features in Qlik Sense. If I get a "BINARY LOAD is Supported in Qlik Sense 3.2" statement from any Qlik employee today, I would start using it tomorrow.

Until that happens, we still face the issue that Qlik Sense has no separation between ETL process (Data Engineers) and Layouting (Report Designers), which is a major issue in our workflow. Especially as we know that BINARY Load is basically working in Qlik Sense Server.

0 Likes
352 Views
Partner
Partner

Hey Damian,

just to clarify: is it also possible to drop the previous SectionAccess table and create a new one?

0 Likes
352 Views
asluzhiv
New Contributor

Hey Riccardo,

yes, in my experience that is exactly what happens if you have another Section Access statement after the BINARY load.

I believe editing/extending the existing Section Access is not possible, as soon as you declare a new Section Access, the old one is removed and replaced with the new Section Access.

Note that you need to have ADMIN access for the user that runs the script, otherwise Section Access statement will throw an error.

0 Likes
352 Views
Partner
Partner

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
352 Views

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

352 Views