Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Qvd separation


Hi,

I have a QVD with five weeks.i need each week as a single qvd.

ex:2013W01->1qvd

2013W02->1qvd

etc.....please find the attachment.

Thanks

Labels (1)
1 Solution

Accepted Solutions
giakoum
Partner - Master II
Partner - Master II

Please check out attached file

View solution in original post

10 Replies
Not applicable
Author

Try something like the following:


let vMaxWeek =  max(week(date))

let vMinWeek = min(week(date))

let QVDDirectory = 'your directory'


FOR i = $(vMinWeek) TO $(vMaxWeek)

LET t = "Week_" & ($(i));

load * from your table

where i = week(date)


STORE [$(t)] INTO [$(QVDDirectory)\DM_$(t).QVD] (qvd);

NEXT i

LET vTotalTables = NULL();
LET t = NULL();

Not applicable
Author

to be precise

week(date)-> weekname(date)

LET t = "Week_" & replace(weekname($(i)),'/','') maybe...

giakoum
Partner - Master II
Partner - Master II

Please see attached file :

LOAD week

FROM

C:\Users\user\Downloads\week.qvd

(qvd);

IF NoOfRows('week') > 0 THEN

  FOR j = 1 TO FIELDVALUECOUNT('week')

  LET currentWeek = FIELDVALUE('week',$(j));

  [$(currentWeek)]:

  LOAD

  '$(currentWeek)' as FilteredWeek

  AutoGenerate(1);

  STORE [$(currentWeek)] into C:\Users\user\Downloads\$(currentWeek).qvd (qvd);

  DROP Table [$(currentWeek)];

  NEXT

ENDIF

Not applicable
Author

Hi Ionnis,  Thanks for your reply.I need the single qvd to be splitted into five Qvd's based on week.  Thanks Gowthami
giakoum
Partner - Master II
Partner - Master II

Well that is exactly what this script does. Did you try it?

Not applicable
Author

Hi Ioannis

Thanks for your reply. I tried with your script, its working fine. But I am trying to do the same with the attached Qvd, am not able to generate Qvd's. Pls help me.,

Regards,

Gowthami

Not applicable
Author

Try this,

If u have a date field in ur table then do likethis

YearWeek:

Load distinct Yearweek(Datefield) as weekyear from sales.qvd order by Datefield;

Rows=Noofrows(Yearweek)-1;

Startrow=0;

Do

Yearweek=Filedvalue(weekyear,$(Startrow));

Ta:

Load * fron Sales.qvd where Yearweek(Datefiled)=$(Yearweek);

Store tab into "F:\Sales_$(Yearweek)";

Startrow=Startrow+1;

while(Rows>=Startrow)

Regards,

Kabilan K.

Not applicable
Author

Pls change the Yearweek() function as Weekname() in my prev reply

giakoum
Partner - Master II
Partner - Master II

Please check out attached file