Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hey Members,
I have a QV script from which I daily import data. I want to schedule this task Please help me out with these simple things.
1. How to automatically update the file from which QV takes the data.
This is how it shows in script –
FROM
(txt, embedded labels);
I need it to update the date automatically so it can take the latest file.
2. After this need it to reload
3. Export the file into .csv format in some folder.
Do I need to make a BAT file to schedule it?? Or is this possible to schedule it from QV?? I do see an option of schedules in Document Properties.
I am very new in QV with very less background of coding. Your help will be much appreciated.
Hi
1. You can use the bat file. And write down the follow script:
"c:\Program Files\QlikView\qv.exe" /r "D:\....\DataExtract.qvw"
2. for generating data you can use this:
$(=date(Today(),'YYYYMMDD'))
3. For export during script you can use command "store tablename into .... (txt) or add trigger after reload with action "Export"
Sergey
Hi Yahs,
but you have Qlik Server?
Through the server can be scheduled reload a qvw
For load, you can adapt the following script, which I created to load data from QVD files up to seven weeks before:
FOR i = 0 to 7
currWeek = Week(Now())- i
currWeekFile = If (Len($(currWeek))=2, $(currWeek), '0'&$(currWeek))
SET currFileName = WEEKLY\NEW_TPM_PROMO_2015_$(currWeekFile).QVD;
IF not IsNull(QvdTableName('WEEKLY\NEW_TPM_PROMO_2015_' & $(currWeekFile) & '.QVD')) then
Data_table:
LOAD * From $(currFileName) (qvd)
ENDIF
NEXT
Regard
Gennaro
Hi,
so I need to set this as a variable.
I have tried this --
Let vText = 'Q:\bns\derivProdData\sybasePortfolio\GEF\positions\epsilon\GEF.ep.TRS';
Let vText2 = '.csv';
Let Date = $(date(Today(),'YYYYMMDD')) ;
FROM
$(vText) & $(Date)& $(vText2)
(txt, embedded labels);
Its not working.. Might be I doing some mistake in setting Date Variable. Please help me out here.
Thanks
Use this:
Let vText = 'Q:\bns\derivProdData\sybasePortfolio\GEF\positions\epsilon\GEF.ep.TRS';
Let vText2 = '.csv';
Let vDate = date(Today(),'YYYYMMDD') ;
LOAD *
FROM
$(vText)$(vDate)$(vText2)
(txt, embedded labels);
Regards
Gennaro
You have missed Load * before From clausule
and after the FROM, to concatenate the variables, do not have to use &
LET vdt=date(Today(),'YYYYMMDD');
LOAD *
FROM
Q:\bns\derivProdData\sybasePortfolio\GEF\positions\epsilon\GEF.ep.TRS.$(vdt).csv
(txt, embedded labels);
Hi
I have tried setting trigger to export the file. (OnPostReload).
How can I export this in a specific filename format with again date as a varible ?
Thanks
Hi!
Use the same way and create variable
Hey Gennaro,
I am able to reload and not able to export the file. I am using following script -
SET DateFormat='M/D/YYYY';
SET TimestampFormat='M/D/YYYY h:mm:ss[.fff] TT';
SET MonthNames='Jan;Feb;Mar;Apr;May;Jun;Jul;Aug;Sep;Oct;Nov;Dec';
SET DayNames='Mon;Tue;Wed;Thu;Fri;Sat;Sun';
Let vdt= date(Today()-1,'YYYYMMDD');
Let Export= 'Q:\bns\derivProdData\spreadsheets\GEF\VG\Extract\SBI Positions Extract Test'& $(vdt)&'.xls';
LOAD TransId as [TransID],
ReferenceAsset as [Reference Asset],
DividendPassThrough as [% Dividend],
FROM
Q:\bns\derivProdData\sybasePortfolio\GEF\positions\epsilon\GEF.ep.TRS.$(vdt).csv
(txt, embedded labels);
$(Export)
Please advise