Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
Is it possible to upload an external script file (to use as described here) via Repository Service API or by any other means? The script needs to be unique per app and sit in the app directory. I will be loading the script within Data Load editor using $(Include=abc.txt);
There's a Content Library Upload available to upload the files to content library, but this doesn't seem to fit the purpose for external scripts.
Thanks,
Andriy
I think what you want to do is edit the script of an app with an include statement. Or you want to upload your script file to the content library and have your app read it.
For the former, the repository service api is for administration and management of the Qlik deployment. The engine api enables you to edit a script within an application.
I don't know if you can reference a script uploaded to the content library via the include statement in script. It will depend on the Include statements ability to read a file from a url.
jg
Hi Jeff,
I'd like to have multiple apps with the same data load script. Within the data load script I will be referencing external scripts (via Include). These external scripts will have the same name (abc.txt) but the file body will be unique per app and I was thinking of having the scripts to reside within the app directory.
Now, the challenge that I have with this approach is to be able to upload external script into the app directory on Qlik server.
Thanks,
Andriy
So what I'd do is the following:
1. Go to QMC
2. Create a new content library: call it Includes
3. Add a single file to it so the directory will be created in the file system. Do this through the QMC.
4. Go to an app and create a folder data connection pointing to this folder through the file system (%programdata%\Qlik\Sense\Repository\Content\Foo) and call it MyDataFiles (or whatever you want).
5. Reference your Include using $(Include=lib://MyDataFiles\abc.txt); replacing MyDataFiles with the name you gave the data connection.
From here you should be good to go.
jg
I will be having multiple copies of the same application. I want each applicatino copy to use it's own external script, not to share the one on the Content Library.. When loading, each application should use the same data load logic, but with the different variable values, that will be defined within the external scripts.
Initially I though that each app will have it's own directory, but it doesn't seem to be the case (I see all of them inside %ProgramData%\Qlik\Sense\Apps).
One way of ensuring that I load the script dedicated for a particular copy of the app, would be to name the script with the app id (ffac6ed6-98d2-4e22-8f1f-f7f99362f475.txt). Is there any way to get the id of the app from within the data load script?
I think I found a way (thanks for the ideas Jeff):
1. Upload External scripts to the Repository (each one named with the id of the app instance). As an example, ffac6ed6-98d2-4e22-8f1f-f7f99362f475.txt having a line:
SET vExtParam='SomeValue';
2. Within the app create a Folder Data Connection, name it Scripts
3. Within the the Data Load Editor use the following
SET vDocName=DocumentName();
SET vPath='lib://Scripts/' & ${vDocName} & '.txt)';
$(Include=${vPath});
LOAD ..... WHERE Condition='$(vExtParam)';
4. Create as many copies of the app, as you need. For each copy, upload .txt file with the same id, as the app.
Yup, that's the idea. Please mark the post helpful or answered when you get a chance.
Cheers,
Jeff G
Hey,
5 years down the line this post led me to try the following. I Needed to centralise my script in Enterprise environment without access to the back end server and this post led be to try the following - might help someone:
1. Drop script text file (using notepad++) through the AttachedFile in the app (there can be as many as needed)
2. Type the following in your load script:
SET vPath='lib://AttachedFiles/LoadScript.txt';
$(Include=${vPath});
Where LoadScript.txt is the name of your file.
Cheers!