Qlik Community

QlikView Publisher

Discussion Board for collaboration on QlikView Publisher.


Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

New Contributor II

Writing to a text file from publisher


I have a QVW who's sole job is to download data and put it into a QVD, however it's not a straight forward as that!

The data comes from a website on our network, but it requires logging into with a username and password, then saves the results as a CSV file.

I'm using the VBScript module to do the logging in and downloads, which puts the CSV data into a variable. The problem I'm having is writing that to a file, so I can then import it into the QVD.

I tried adding it into a temp table and storing it, but as it's properly formed CSV, with quotes, comment lines and everything, the outputted file has everything double quoted with extra quotes at the beginning and end. I tried adding no quotes to the format-spec, but that's for load only apparently.

My next attempt is to write another VBScript macro that takes the variable and writes it to a file using FileSystemObject.

Function WriteFileText(sFilePath, sText)

dim r on error Resume next

      with CreateObject("Scripting.FileSystemObject")

if err<>0 then r="Error Creating Object:" & err.description

     if err=0 then

        with .CreateTextFile(sFilePath, True)

        if err<>0 then r= "Error Creating File:" & err.description

        if err=0 then

          .Write sText

          if err<>0 then WriteFileText="Error writing text:" & err.description


       end if

        end with

        end if

    end with WriteFileText= r

End Function

This works perfectly when run from the QlikView application and I'm very happy with it, but I want this to be a scheduled task, run by the  publisher, but the script fails at the CreateObject line with the message

ActiveX component can't create object

I'm developing as the same user as the Publisher service is running on, so far as I can tell all the macro settings are on allow system access, but I can't see where to set this for the publisher.

Any suggestions?

2 Replies
Not applicable

Re: Writing to a text file from publisher

Hi Ben,

I have a similar problem. Did you find a solution for this problem?

New Contributor II

Re: Writing to a text file from publisher

Hi Marcel,

We had to work round it in the end and externalise the scripts, so the publisher now runs an external task which calls a VBScript with cscript.

The script reads a text file of parameters to control the download dates and saves the data into a CSV file. Then a task opens the loader QVD which imports the CSV as normal, then calculates the next download dates and STOREs them in a CSV file, ready for the VBScript to be run again next time.

It's a bit convoluted, but it works!

Hope that helps.