Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Jackduring
Partner - Contributor II
Partner - Contributor II

Conditional Binary Load

Hi Everyone,

I am trying to do a Binary Load with a condition in QlikView.

In this QlikView project, the data loading is triggered by events, so that different data is loaded in different moments, using if conditions, subs and calls depending on the value of a variable (vLoad).

For one specific event, I need some data to be loaded from another QlikView file, using a Binary statement. What I don't want to do is to load the Binary every time there is a reload, but only when the variable vLoad has a specific value, to increase performance and avoid waste of memory in the server.

Since it is not possible to completely exclude the Binary in the script because it must be placed at the top,  I created an empty Qlik file to use in the Binary instead of the one with data, so that there is still a binary but no data is loaded when not needed.

My script is something like this:

Binary $(vLoadBinary);

LET vLoad='LOAD';

LET vLoadBinary= if(vLoad='LOAD', '\\PATH\Qlik with data.qvw', '\\PATH\Qlik with no data.qvw');

It is not working. Does anyone have an idea of how to make it work?

Thanks in advance for your help and support.

Labels (1)
6 Replies
marcus_sommer

I'm not sure if I understand your issue right but couldn't you branch between your various load-mode one step before? Quite common is the use of a 3-tier data-architecture which enables in general the possibility to apply incremental loadings. But by larger / more complex environments you may need some more processing-layer.

Beside this I could imagine that a (batch executed) rename of the file-name and/or change of the variable/script in the qvw might be a more practically approach.

- Marcus

Jackduring
Partner - Contributor II
Partner - Contributor II
Author

Thank you for your reply Marcus.

Maybe I wasn't enough clear in presenting my problem: my issue is not related to an incremental load of the data, but to scheduling the automatic reload of different types of data. For one type of data I have to do a Binary which I would like to exclude from the reload of the other types of data. The reload of each type of data is triggered by a variable in the Qlik View Management Console.

Since it is not possible to move the binary statement from the first position in the script neither to exclude it with an if condition, I am trying to change the path of the binary in order to load an empty qvw when I don't need the data from the Binary to be loaded. This is why I am trying to insert a variable with a different path in the Binary statement.

I think it is possible but I get an error trying to reload the data.

Many thanks again

marcus_sommer

Do you mean with insert a variable to create a new one or to change the value of an existing variable? How did you try it?

- Marcus

Jackduring
Partner - Contributor II
Partner - Contributor II
Author

I mean like this

Binary $(vLoadBinary);

LET vLoad='LOAD';

LET vLoadBinary= if(vLoad='LOAD', '\\PATH\Qlik with data.qvw', '\\PATH\Qlik with no data.qvw');

vLoad is my variable that triggers the load of the data from the Binary. So using those two variables I could make the Binary statement changing dinamically (loading the Binary from the qvw with the data or without data depending on the value of the vLoad variable, which is populated from the QMC based on external events).

Trying like this I get an error.

 

I tried also using this script:

IF vLoad='LOAD' THEN Binary \\PATH\Qlik with data.qvw; ELSE Binary \\PATH\Qlik with no data.qvw;

I get the same error, as Qlik is not able to read the  Binary.

marcus_sommer

The first one should work - if syntax would be correct - and then second one is not valide because it would require a processing before the binary is executed. Try first one in this way:

Binary $(vLoadBinary);

LET vLoad='LOAD';

LET vLoadBinary= if('$(vLoad)'='LOAD', '[\\PATH\Qlik with data.qvw'], '[\\PATH\Qlik with no data.qvw]');

- Marcus

cwolf
Creator III
Creator III

If I understand you correctly, then you have several tasks on this qvw. Each of them is triggered by a external event and each of them set a different value for the variable vLoad.

If so, it needs simly changes to get what you want.

The first lines of your script should be:

$(vLoadBinary);; //it's important to have two semicolons here!

if Left('$(vLoadBinary)',6)='BINARY' then
   set vLoad='Load';
   set vLoadBinary = '';
end if

Change the parameter settings of the "Load"-Task to:

Parameter name :  vLoadBinary
Parameter value :  BINARY [\\Path\to\Qvw.qvw];

Thats all.

- Chritian