6 Replies Latest reply: Jun 10, 2015 7:33 PM by Jeffrey Goldberg RSS

    External script files - upload via Repository Service API

    Andriy Fedotov

      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

        • Re: External script files - upload via Repository Service API
          Jeffrey Goldberg

          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

            • Re: External script files - upload via Repository Service API
              Andriy Fedotov

              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

                • Re: External script files - upload via Repository Service API
                  Jeffrey Goldberg

                  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


                    • Re: External script files - upload via Repository Service API
                      Andriy Fedotov

                      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?