Skip to main content
Announcements
Qlik Community Office Hours, March 20th. Former Talend Community users, ask your questions live. SIGN UP
cancel
Showing results for 
Search instead for 
Did you mean: 
NZFei
Partner - Specialist
Partner - Specialist

How to get QV variable values to bat script ?

I want to set up a batch file to run QV automatically and then transfer stored txt file D:\QMC.txt to zip file. After that sent to server.

The bat file below works:

"c:\program files\qlikview\qv.exe" /r -vPaticipantCodeType=AMC "d:\Export\TestExport.qvw"
set MyFilename="D:\QMC.zip"
"c:\program files\winrar\rar.exe" a %MyFilename% "D:\QMC.txt"
echo servername>ftp.txt
echo password>>ftp.txt
echo binary>>ftp.txt
echo cd XX>>ftp.txt
echo put %MyFilename%>>ftp.txt
echo quit>>ftp.txt
ftp -s:"ftp.txt" ncexx.com
del %MyFilename%
del ftp.txt
set MyFilename=

Now the problem is QMC.txt is just a test file name. The really file name is dynamic, getting from variables from QV. I don't know how to get variable values to bat script to create a dynamic file name.

For example the stored txt file from QV is $(vDate)$(vSequenceNo).txt  The vDate and vSequenceNo are variables in QlikView script.

How can I get the variable values from QlikView? I have tried $(vDate)$(vSequenceNo) and %vDate%%vSequenceNo% and  they didn't work.

set MyFilename="D:\$(vDate)$(vSequenceNo).zip"
"c:\program files\winrar\rar.exe" a %MyFilename% "D:\$(vDate)$(vSequenceNo).txt"   (Not work)

set MyFilename="D:\ %vDate%%vSequenceNo%zip"
"c:\program files\winrar\rar.exe" a %MyFilename% " D:\%vDate%%vSequenceNo%txt"  (Not work)

Can anyone help me please? Thanks!

1 Reply
Not applicable

I am not an expert in Qlikview but maybe if you can use two folders("all" and "latest") and make qlikview send the newest file to say folder "latest" then make your batch file take the file from that folder and after making the necessary(zipping and sending to server) move the file to folder "all"