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

create log file from Qlikview document

Hello everyone!

I hope someone can help me.

Due to the complexity of the data being displayed in my Qlikview document, I find that a tutorial page within my document will be necessary. I would like to work this way:

The first time a user access the document via IE plugin, the user has to run the tutorial before he can access the rest of the document. Once the tutorial is completed, the user can then start to view the rest of the document.

I don't know how to do this because it will envolve using the user access section of the document. I can reload the document every so often with Qlikview Publisher but I don't know if it is possible to create or add data to a text file from the Qlikview file every time a user completes the tutorial so that his credentials can be loaded and used by the section access on the next reload.

Any suggestions would be greatly appreciated.

Daniel.

1 Solution

Accepted Solutions
Not applicable
Author

I thought I would reply to my own post since I have now found how to do it.

At the end of the tutorial I have a button that the user clicks and runs a macro that will write into a text file the user windows ID. Every time the document is reloaded, the file created is loaded into the script so any users recorded in the file will not see the tutorial again.

Let me know if you would like to see the code for the macro.

View solution in original post

5 Replies
Not applicable
Author

I thought I would reply to my own post since I have now found how to do it.

At the end of the tutorial I have a button that the user clicks and runs a macro that will write into a text file the user windows ID. Every time the document is reloaded, the file created is loaded into the script so any users recorded in the file will not see the tutorial again.

Let me know if you would like to see the code for the macro.

Anonymous
Not applicable
Author

Hi Brooky,

Can you share the code for writing o a text-file with me please?
Sounds interesting.

Thanks,

Dennis.

Not applicable
Author

Sure!

This code doesn't do anything too fancy. The VBA code creates a text file to store user details. If the file already exists, it will append to the bottom of it. You can then use it as an input table in your QV script. I hope it helps!

Daniel

SUB WriteAccess()
DIM fso, MyFile, strFile, strText
strFile="C:\"
Set fso = CreateObject("Scripting.FileSystemObject")

If fso.FileExists(strFile) Then
Set MyFile = fso.OpenTextFile (strFile, 8, True)
Else
Set MyFile = fso.CreateTextFile(strFile)
MyFile.WriteLine("Date,User")
End If

strText=Now() & "," & ActiveDocument.GetLayout.AuthenticatedUser
MyFile.WriteLine(strText)
MyFile.Close
END SUB



pkkushwaha
Partner - Contributor II
Partner - Contributor II

Hi ,

I am also facing similer kind of problem.

I want to write VB code to open Qlikview new window but when i run below code, application get open in existing QV window.

Can anyone please help me on this. and is there any code to close the activate windo then please mention that also.

Set Qv = CreateObject("QlikTech.QlikView")

            'Set docObj = Qv.OpenDoc(QvPath, 3, False)

            'Set docObj = Qv.OpenDoc(QvPath, "", "")

            Set docObj = Qv.OpenDoc(qvpath, 3, False)

            docObj.Reload

            'Sleep 40000

            docObj.Save

            docObj.CloseDoc

           Set docObj = Nothing

            Set Qv = Nothing

disqr_rm
Partner - Specialist III
Partner - Specialist III

Macro is great and I am sure it's workign as you desire. Another good option could be to stich on the "Generate Logfile" optionunder Document Settings, and use TRACE command in your script to write anything you want in your log file.