Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Writing "Hello World" to a text file from the script

My end goal is to write a text file in a certain format upon reload of a QVW.  The text file must use data gathered upon the reload in this text write out.

As a simplified example, I'd like a text file that says:

Hello World.

Field: Field1Name, Row: 1, Value=5 [that 5 was gathered upon reload]

Goodbye World.

I have been looking through the help and the forums and see no way to directly write to a text file from the script.  I understand that you can use a store command and store a table in a text file, but that is not what I'm looking for.  As step 1, I was wondering if anyone knows how to just write "Hello World" to a text file within the Qlikview script?

I saw that many people are using an Upon Post-Reload macro to write specific info to text files.  Is that the only way?  That would make my task more difficult because then I would have to get information from one of my tables in the data model loaded into my macro so that I could use it to help write my text file. 

Any thoughts are appreciated! Thanks.

1 Solution

Accepted Solutions
matt_crowther
Luminary Alumni
Luminary Alumni

I use the following to do what you're requesting:

Conf:

Load 'Reload Completed: '&now() as Confirmation

AutoGenerate 1;

STORE Conf Into \\usavm090\Logs\QV_Triggers\CONV_Conf.txt (txt);

Drop Table Conf;

Of course you can add expressions etc into the table to give more information, in my case the text file is created so a monitoring tool can spot the files creation and trigger a further event.

 

Hope that helps,

Matt - Visual Analytics Ltd

View solution in original post

6 Replies
matt_crowther
Luminary Alumni
Luminary Alumni

I use the following to do what you're requesting:

Conf:

Load 'Reload Completed: '&now() as Confirmation

AutoGenerate 1;

STORE Conf Into \\usavm090\Logs\QV_Triggers\CONV_Conf.txt (txt);

Drop Table Conf;

Of course you can add expressions etc into the table to give more information, in my case the text file is created so a monitoring tool can spot the files creation and trigger a further event.

 

Hope that helps,

Matt - Visual Analytics Ltd

Not applicable
Author

Your answer fixed my problem.  Turns out in my testing I did not add the (txt) at the end of the store statement which was putting myoutput in xml format.  This will get me going.  Thanks!

Not applicable
Author

Thanks Mathew thsi tip helped me out



Not applicable
Author

hi

is any way to do this using a macro. i donot want to reload my app

tnx

Not applicable
Author

Hi,

    With normal API's its not possible as per my knowledge, but document can be reload using below code

Sub Reload

ActiveDocument.Reload

ActiveDocument.Save

End Sub

maykerreyes
Contributor II
Contributor II

Excellent!!!