Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Batch file and Dodument reload

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.





1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

I'm sure you forgot to remove that msgbox() line we used for testing yesterday

View solution in original post

11 Replies
Anonymous
Not applicable
Author

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?

Not applicable
Author

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

Anonymous
Not applicable
Author

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.

Not applicable
Author

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

Anonymous
Not applicable
Author

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.

Not applicable
Author

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,

Anonymous
Not applicable
Author

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?

Anonymous
Not applicable
Author

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)

Not applicable
Author

Thank you so much Michael, It worked well the only issye it after reducing data and save as at the end it ask for the cofirmation. it pop up with small window and it is like this

It does not exit(quit) application untill i hit ok. So any set up i need to do.

Once again Thank you for your help.