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