Skip to main content
Announcements
Accelerate Your Success: Fuel your data and AI journey with the right services, delivered by our experts. Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
sharanqlik
Contributor II
Contributor II

Qlik Sense Binary Load with variable in folder path

We have a scenario where we need to do a binary load from one of the two files stored at two different locations based on some condition.

The problem is Binary load has to be the very first statement of the load script. 

Normally what we do is define a variable which dynamically stores the folder connection name (based on condition) and then use that variable while fetching data.

example -

let vPath= if(Day(Today())='Sunday',Folder1,Folder2);

load *  from [lib:\\$(vPath)\abc.qvd](qvd);

This works fine in case of qvds or other files. But with Binary, we can not use the same logic because then Binary wont be the first statement in script. Any way to use Binary as 'not the first' statement of the load script ?

Any approach/discussion will help, thanks.

4 Replies
stevejoyce
Specialist II
Specialist II

Your first statement can reference a txt file which can be a Binary load statement.  What if you use a qlik load script that reloads before your binary reload app, that stores the binary connection string into a txt file (always same txt file, but content can change dynamically).

This way your actual binary string is dynamic.

sharanqlik
Contributor II
Contributor II
Author

Thanks for the reply Steve !

are u saying -

1. Create a qlik sense app that stores value in vPath variable based on condition.

2. Create a txt file that stores statement like 'Binary [lib:\\$(vPath)\abc.qvw] '. vPath value will be 'Folder1' or 'Folder2' as set by app in step 1.

3. In actual app with visualization etc. use Include or MustInclude to call that txt from step 2 (as very first statement).

4. Make it mandatory to reload app1 before app 3 reloads.

Is my understanding correct ?

This could work, but maintaining a pre-app for every app where Binary load is used could be difficult in different environments. But yeah it a good idea to try. 

 

stevejoyce
Specialist II
Specialist II

Yes that's what i'm saying.  I'd be surprised if you needed another app that stores vPath variable.  Since binary load is loading another source app, when that source app reloads, have it store the Binary statement, with new evaluation of vPath, to your txt at the end.

 

sharanqlik
Contributor II
Contributor II
Author

The source app is from a different plant, environment itself. so we can not be dependent on that.

Thanks for this, we will try this as last resort. Please let me know if you get any other idea which does not involve a second app.