Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
I have two years data .i have to store the data into weekly qvd's. let's assume i have if i have two months data and i need to break the data into weekly qvds for every week.And qvd name should be the week start name.
Any help will be appreciated.
The script I already posted is in the attachment
I tried, reload and I get the s.qvd (test data) splitted in weeks qvd
example w_20150126.qvd has dates from 26 jan to 01 feb
Save your qvds like this may be:
FileName_201501.qvd
FileName_201502.qvd
and so on...
and when you try to pull them you can do this:
TableName
LOAD *
FROM FileName_*.qvd (qvd);
and this will auto-concatenate everything to the Table TableName
Hope this is what you were looking for? If not please explain...
Best,
Sunny
// test data, one year of dates stored in a qvd
//
s:
load
date(makedate(2015) + rowno() -1) as date,
floor(rand()*100) as val
AutoGenerate 365;
STORE s into s.qvd;
// loop to store by week
//
t: load
date(min(date)) as mindate,
date(max(date)) as maxdate
from s.qvd (qvd);
let vmindate=peek('mindate');
let vmaxdate=peek('maxdate');
let vweekstart=(WeekStart(vmindate));
let vweekend=(WeekStart(vmaxdate));
do while vweekstart <= vweekend
trace vweekstart=$(vweekstart);
w:
NoConcatenate load * from s.qvd (qvd)
where date >= '$(vweekstart)' and date <= date('$(vweekstart)'+6);
let file = 'w_' & date(Date#('$(vweekstart)'), 'YYYYMMDD');
trace file=$(file);
STORE w into '$(file)'.qvd (qvd);
DROP Table w;
let vweekstart=date(vweekstart+7);
loop;
Hi Sunny ,
Thanks for immediate reply !!
i need to load the data and i have to store the data into qvd's .
suppose if i have one year data with date .
lets start date =2014-01-01 and End Date = 2015-01-01
I need to run my database query on above condition.
suppose if 1st jan 2014 has 4 weeks then i have to seperate data for each week and store it in qvd .
thanks massimo!!
Hope your solution might work for me .
thank you
Hi massimo
i couldn't enter the loop.My script stops executing before the loop.
What error did it give you before it entered the loop???
Hi
It's not the error , my script execution ends there .Any how i rectified.
but i need to name the qvd with its weekstartname for every week .
This seems to be already doing that:
let file = 'w_' & date(Date#('$(vweekstart)'), 'YYYYMMDD');
trace file=$(file);
STORE w into '$(file)'.qvd (qvd);
DROP Table w;
Hi
lets asssume i have one month data .One month has 4 weeks .
while i am loading one months data first week's data should be stored in one qvd and this qvd should be named with weekstart of that particular week.
The same should be repeated for remaining 3 weeks and 3 qvds should be generated ,
thanks