Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
I'm trying to create the template report and dinamicly store it where i need it to be stored. Problem is that i don't know how. For example i'm runing template script from .bat file and inputing argument from command line that it is a report No.5. Script should check the report number and if it is report number five store it in different folder with specific name.
Could anyone assist me on this matter? And thank you in advance for your answers.
Best regards,
I see.
So maybe the below scenario using a macro will be helpful.
I'll use the same batch command line as the one in my previous post.
The QVWFile.qvw will contain the variable "i" and the below macro (ctrl+m):
sub savedoc
vMacro = ActiveDocument.Variables("i").GetContent.String
if vMacro = 0 then
vdoc = "C:\Users\Test\Desktop\File1.qvw"
vfolder = "C:\Users\Test\Desktop\folderA\"
else
vdoc = "C:\Users\Test\Desktop\File2.qvw"
vfolder = "C:\Users\Test\Desktop\folderB\"
end if
set pathdoc = ActiveDocument.GetApplication.OpenDoc(vdoc,"","")
namedoc = Mid(pathdoc, InStrRev(pathdoc,"\") + 1)
pathdoc.SaveAs(vfolder & "\" & namedoc)
pathdoc.CloseDoc
end sub
Then add in QVWFile a document trigger OnPostReload to RunMacro savedoc (Settings > Document Properties > Triggers > Document Event Triggers).
Now when the batch file is executed, based on the argument value, it will either save File1 in FolderA or File2 in FolderB.
Hope that this answers your initial request
Hello,
Does your request consist only in changing the store command path based on the parameter from the batch file ?
If that's the case, then the below example will help you:
table1:
LOAD ...;
if match($(i),0) then
set qvdpath = 'folderA\';
ELSE
set qvdpath = 'folderB\';
ENDIF
STORE table1 into $(qvdpath)table1.qvd;
The batch command would be for example:
"C:\Program Files\QlikView\QV.exe" /r /vi=0 "C:\Users\Test\Desktop\QVWFile.qvw"
Make sure that the variable exists in your app and not to have any let/set statement in your script that can override the value passed from the batch.
Regards
That is for storing qvd files (data/table files) what i need is to store whole report (qvw) file in a specific folder. But thank you for your answer!
I see.
So maybe the below scenario using a macro will be helpful.
I'll use the same batch command line as the one in my previous post.
The QVWFile.qvw will contain the variable "i" and the below macro (ctrl+m):
sub savedoc
vMacro = ActiveDocument.Variables("i").GetContent.String
if vMacro = 0 then
vdoc = "C:\Users\Test\Desktop\File1.qvw"
vfolder = "C:\Users\Test\Desktop\folderA\"
else
vdoc = "C:\Users\Test\Desktop\File2.qvw"
vfolder = "C:\Users\Test\Desktop\folderB\"
end if
set pathdoc = ActiveDocument.GetApplication.OpenDoc(vdoc,"","")
namedoc = Mid(pathdoc, InStrRev(pathdoc,"\") + 1)
pathdoc.SaveAs(vfolder & "\" & namedoc)
pathdoc.CloseDoc
end sub
Then add in QVWFile a document trigger OnPostReload to RunMacro savedoc (Settings > Document Properties > Triggers > Document Event Triggers).
Now when the batch file is executed, based on the argument value, it will either save File1 in FolderA or File2 in FolderB.
Hope that this answers your initial request
This might actualy work Thank you!