Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Announcements
Modernize Your QlikView Deployment webinar, Nov. 3rd. REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Specialist
Specialist

load data into qvds for each week

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.

1 Solution

Accepted Solutions
Highlighted
MVP
MVP

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

1.png

View solution in original post

20 Replies
Highlighted

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

Highlighted
MVP
MVP

// 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;

Highlighted
Specialist
Specialist

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 .

Highlighted
Specialist
Specialist

thanks massimo!!

Hope your solution might work for me .

thank you

Highlighted
Specialist
Specialist

Hi massimo

i couldn't enter the loop.My script stops executing before the loop.

Highlighted

What error did it give you before it entered the loop???

Highlighted
Specialist
Specialist

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 .

Highlighted

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;

Highlighted
Specialist
Specialist

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