Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I am running a batch file to reload the documnet with variable passed to documnet.
cd e:\qv\datasource\ProviderAnalysis
"C:\Program Files\Qlikview\qv.exe" /r /vvDataSubset=Pract ProviderInterfaceTest.qvw
"C:\Program Files\Qlikview\qv.exe" /r /vvDataSubset=Fac ProviderInterfaceTest.qvw
It loads it fine, the issue i have is it asks me once documet starts loading it prompts me for SaveAs option to ave the documnet. I am using have macro in which i use following option to create file. I am not sure what am i missing.
ActiveDocument. SaveAs
"E:\qv\production\Quick Reports - " & vDataSubset.GetContent. String & ".qvw"
Any pointer to this would be great.
Thank you in andvance.
I'm sure you forgot to remove that msgbox() line we used for testing yesterday
To troubleshoot, try to add a test line in your macro before (or instead of) SaveAs:
msgbox("E:\qv\production\Quick Reports - " & vDataSubset.GetContent. String & ".qvw" )
and see if it gives your the correct file name.
Also it bothers me that the macro line in your post is broken into two lines. Is it one line in your actual macro?
Thank you for your reply,
It gives me correct file name and yes it is one line in macro. I have reduce data in macro. I guess that is why it is prompting me to saveas.
Any idea please.
Thank you
Hmm..., Maybe this is because you're saving over the existing file with the same name(?) To test, try to delete the existing file manually, and run the macro.
Yes,
I have one main file, I reload that file and then split in to two file with reduced data, the macro is on postreload.
SUB PostLoad
Dim lvDataSubset
Set vDataSubset = ActiveDocument.Variables("vDataSubset")
Set vDefaultOutput = ActiveDocument.Variables("vDefaultOutput")
'************************** Reduce Data to appropriate provider class *************
set cs = ActiveDocument.GetField("OutputFormatName")
set prop = cs.GetProperties
prop.OneAndOnlyOne = false
cs.SetProperties prop
ActiveDocument.SaveAs "E:\qv\production\Quick Reports - " & vDataSubset.GetContent.String & ".qvw"
ActiveDocument.ClearAll true
ActiveDocument.Fields("ProviderClass").Select vDataSubset.GetContent.String
ActiveDocument.Fields("ProviderStatus").Select "Active", true
ActiveDocument.ReduceData false
'************************** Reset Selections and Default Output version *********
ActiveDocument.Fields("ProviderClass").Select vDataSubset.GetContent.String
ActiveDocument.Fields("ProviderStatus").Select "Active"
ActiveDocument.Fields("OutputFormatName").Select "='" & vDefaultOutput.GetContent.String & "'"
ActiveDocument.Fields("OutputDimensionDescripton").SelectPossible
SetDefaults("ProviderClass")
SetDefaults("ProviderStatus")
SetDefaults("OutputFormatName")
ChooseOutputFormat
ActiveDocument.Save
END SUB
I think that it is because you're trying to use "Save" after reducing the data. It probably will work if you use "SaveAs" in the second part.
Once again thank you for your reply.
I had saveas in place of .save, i changed it to save to go as under
1. After reload of main document save that document with new name with save as .
2. reduce the data in the new document
3. save the new document
When i do save as it is also saving main document. Please correct me if i am wrong,
In general, it makes sense. It all depends of what you really need. Maybe think of this:
1. Reload main document using /l switch instead of /r (reload without saving)
On postreload macro
2. Reduce
3. SaveAs.
The major difference is that the main document is always the same, maybe keep it empty.
Was the uinwanted "Save As" fixed?
I got a few minutes to try... See attached (I know it's simplified, just testing the approach)
(Sure you'll have to edit the qv.exe and file location in the batch.bat)