Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello!
I have created .bat file, and inside there is this code :
"C:\Program Files\QlikView\qv.exe" /nodata "D:\QV\lm\Sa.qvw"
An window of Qlik is then opened with my app without data.
Next I have to save it and close.
How to do it through batch file, via commands?
I have found the solution. A lot of these did not work the way I wanted, so I will paste an answer here.
Just in case someone had similar problem like me, and the rest of topics would be not available for them, like it was in my case.
1. Create new notepad file text in folder where You need to erase data and safe template of Your app.
2. Open the file and paste inside :
Set MyApp = CreateObject("QlikTech.QlikView")
Set MyDoc = MyApp.OpenDocEx("DISKDRIVE_LETTER:\PATH_TO_SOURCE_FILE\FILENAME.qvw", 0, False)
Set ActiveDocument = MyDoc
MyDoc.RemoveAllData()
MyDoc.SaveAs("DISKDRIVE_LETTER:\PATH_TO_FINISHED_ERASED_FILE\FILENAME.qvw")
MyDoc.CloseDoc()
MyApp.Sleep 2000
MyApp.Quit()
Set MyDoc = Nothing
Set MyApp = Nothing
3. Change bolded paths above in your script to be correct for Your case.
4. Save file and exit notepad.
5. Right click on text file You have created, to change extension of it to .vbs
**** You have to have enabled "show known extension" on Viewer option in Windows *****
Now it is possible to include this script in Windows Scheduler, and it will create automatically empty of data file.
I have found the solution. A lot of these did not work the way I wanted, so I will paste an answer here.
Just in case someone had similar problem like me, and the rest of topics would be not available for them, like it was in my case.
1. Create new notepad file text in folder where You need to erase data and safe template of Your app.
2. Open the file and paste inside :
Set MyApp = CreateObject("QlikTech.QlikView")
Set MyDoc = MyApp.OpenDocEx("DISKDRIVE_LETTER:\PATH_TO_SOURCE_FILE\FILENAME.qvw", 0, False)
Set ActiveDocument = MyDoc
MyDoc.RemoveAllData()
MyDoc.SaveAs("DISKDRIVE_LETTER:\PATH_TO_FINISHED_ERASED_FILE\FILENAME.qvw")
MyDoc.CloseDoc()
MyApp.Sleep 2000
MyApp.Quit()
Set MyDoc = Nothing
Set MyApp = Nothing
3. Change bolded paths above in your script to be correct for Your case.
4. Save file and exit notepad.
5. Right click on text file You have created, to change extension of it to .vbs
**** You have to have enabled "show known extension" on Viewer option in Windows *****
Now it is possible to include this script in Windows Scheduler, and it will create automatically empty of data file.
Thanks Renovero , it was helpful for my case.
but if change
Set MyDoc = MyApp.OpenDocEx("DISKDRIVE_LETTER:\PATH_TO_SOURCE_FILE\FILENAME.qvw", 0, False)
to
Set MyDoc = MyApp.OpenDocEx("DISKDRIVE_LETTER:\PATH_TO_SOURCE_FILE\FILENAME.qvw", 0, False, , , , True)
.qvw at once open without data !
It 's more faster for large file.
For my case, i have many .qvw file in folder, and I want save it all wihout data.
For this one I create this code in .vbs file:
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Dim MyApp, fldPath, FSO, File, Folder, filExt
Set FSO = CreateObject("Scripting.FileSystemObject")
fldPath = InputBox("Enter path of files?", "Directory Path")
If Trim(fldPath) = "" Then
MsgBox "No directory was entered.", vbOKOnly
WScript.Quit
Else
If FSO.FolderExists(fldPath) Then
'Continue program
Else
MsgBox "Directory does not exist.", vbOKOnly
WScript.Quit
End If
End If
Set Folder = FSO.GetFolder(fldPath)
Set MyApp = CreateObject("QlikTech.QlikView")
For Each File In Folder.Files
If Right(File.Name, 4) = ".qvw" Then
vPath = fldPath & "\" & File.Name
Set MyDoc = MyApp.OpenDocEx(vPath, 0, False, , , , True) 'Open qv document without data!
MyDoc.Save
MyDoc.CloseDoc
Set MyDoc = Nothing
End If
Next
MyApp.Quit
Set MyApp = Nothing
MsgBox "Finished"
'''''''''''''''''''''''''''''''''''''''''''''''''
May be someone it helpfull too.