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

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
ioannagr
Creator III
Creator III

Help! concatenation of qvds by day into one

Hello guys!

I have made qvds by day like  qvd_01.01.2000 to qvd_24.05.2021 so as to handle a big table.

Now I want to concatenate them into one.

I tried 

LOAD * 

 FROM [$(vPathQVD)qvd_*.qvd]
(qvd);

Yet it returns 0 rows.

(Qlik stored them in folders in a very weird way in the path, like first it did the days then the months, then the year

for example, qvd_01 -> qvd_01.01, qvd_01.02, etc (first day of all months ) -> qvd_01.01.2000, qvd_01.01.2001, qvd_01.01.2002 etc , 

qvd_02 -> qvd_02.01, qvd_02.02, etc (second day of all months ) -> qvd_01.01.2000, qvd_01.01.2001, qvd_01.01.2002 etc)

 

Help please?

1 Solution

Accepted Solutions
marcus_sommer

You may add it in this way:

...
let vDate = Peek('Date',$(n)-1,'TempDate');
let vDate2 = date('$(vDate)', 'YYYYMMDD');
...
store TotalSize  into [$(vPathQVD)/TotalSize_$(vDate2).qvd];
...

To aggregate anything within the load is one of the most heavy measures which could be done within the script. This relates to the CPU as well as to the consumed RAM and should be measured and controlled during the run-time of the loads. Especially if there isn't enough RAM available for this task it could slowdown very significantly.

Your applied approach of slicing the buckets smaller is of course possible but often not the only measures and not always the most suitable one. In each case you should know which tools/tasks/ processes run in parallel and how many resources do they consume and from your task the same + how many records/field-values are loaded - and how many available resources are left. By any kind of performance issues to monitor the hardware resources should be the first measure.

Beside this and already hinted an aggregation of the data may not always be useful - especially if it's not reduce the number of the distinct field-values which may happens in your case by aggregating values against a rather granular ID. Because of the special storing-logic from Qlik - only distinct field-values in own system-tables and using bit-stuffed pointer to the data-tables - you may reduce with your aggregation the number of records in a rate from 1:20 to 5% but the needed RAM may only drop to 90% and calculating with them in the UI may also give rather small and maybe unnoticed performance benefits from 10%.

IMO there is no general rule on which dataset and with which requirements to show which views which approach would return the best results - but aggregating the data should be rather the last measurement to ensure a certain degree of performance and not applied in a prophylactic manner.

- Marcus 

View solution in original post

17 Replies
eddie_wagt
Partner - Creator III
Partner - Creator III

Hello @ioannagr ,

The syntax should be correct. I tested your code with pseudo qvd's. Did you verify if the QVD's have data and did you check the path in the variable vPathQVD ? 

Regards Eddie

ioannagr
Creator III
Creator III
Author

Hi @eddie_wagt  yes I have! 

LET a=Date#('01/01/2000', 'DD/MM/YYYY'); 
Let b=Date#(today()-1, 'DD/MM/YYYY');

Trace $(a);
do while a < b
a1 = date(a, 'DD/MM/YYYY');

trace $(a1);

LOAD
*
FROM [l$(vPathQVD)/qvd_$(a1).qvd]
(qvd);

LET a=a+1;

loop

 

 

With the above script it goes from my starting date to yesterday but not all dates have qvds because nothing happened on this date, how do i not take these days into account so that the script doesn't fail?

 

eddie_wagt
Partner - Creator III
Partner - Creator III

Hello @ioannagr ,

Hey this is different code? It looks something right, but variable a1 does not meet the fileformat?

these are your files: qvd_01.01.2001 and a1 has output qvd_01/01/2001

If  your are not using LOAD * from qvd_*.qvd (qvd) and if your want to use the loop then I suggest to check variable a1 and you could use the function QvdCreateTime function. If file don't exists, returns NULL.

So something like this

 

 

 

LET a=Date#('01/01/2000', 'DD/MM/YYYY'); 
Let b=Date#(today()-1, 'DD/MM/YYYY');

Trace $(a);
do while a < b
a1 = date(a, 'DD/MM/YYYY');



if not isnull(QVDCreateTime('$(vPathQVD)$(a1)')) then

trace $(a1) is not empty and is being loaded;

LOAD
*
FROM [l$(vPathQVD)/qvd_$(a1).qvd]
(qvd);

ENDIF


LET a=a+1;

 

 

 

 

ioannagr
Creator III
Creator III
Author

Hi @eddie_wagt  so that means that if i have data for 01/01/2000 but next i have on 28/01/2000 it will not fail but still show it with trace as :

01/01/2000 lines fetched: 200

02/01/2000

03/01/2000

04/01/2000

...

28/01/2000  lines fetched: 10?

 

Is there a way to not take them into account at all?

 

Many thanks 😁

ioannagr
Creator III
Creator III
Author

Hi @eddie_wagt  tried your way, this doesn't work for me, it just goes in a loop of dates without loading data. Can you point me to a way of concatenating them? Like you saw on my first post, Qlik stored data in a very weird way so I guess that's why 

LOAD * 

 FROM [$(vPathQVD)qvd_*.qvd]
(qvd); 

doesn't work either.

ioannagr
Creator III
Creator III
Author

@Taoufiq_Zarra please kindly look at this, I think i could use your help! The way Qlik stored the daily data into subfolders by DD, then MM, then YYYY has me really confused. 😞

ioannagr
Creator III
Creator III
Author

Maybe also gentlemen @Vegar , @hic  could help me on this 🙂 Thank you in advance.

marcus_sommer

Just to consider the existing files within folders you could use dirlist() and filelist(). Take a look on the help by "for each" because there is a good example how to loop over multiple folders and fetch just those files with a certain name-pattern and/or extension and additionally you may apply within the loop before starting the load multiple further checks on the filename or using functions like filesize() or similar measures.

Beside this it might be useful to re-create all the daily qvd's with a proper filename / foldernames by reversing the date-logic in the names from DD.MM.YYYY to YYYYMMDD.

- Marcus

ioannagr
Creator III
Creator III
Author

@marcus_sommer  thanks for the prompt response, I have 2 issues/ questions.

1)So, if i store them like YYYYMMDD, Qlik won't store them in the way they are now, by DD, by MM, by YYYY?

2) Looked through the help already and tried something like

(In 'General' there are all qvd_01 to qvd_31 and in them all the subfolders)

Let Root='D:\QVDFiles\QVDs\General\';     //DOES THIS  WORK WITH LIB CONNECTION as well?
Sub ScanFolder(Root)
For Each FoundFile in Filelist( Root & '\*' & '.qvd')
If '$(FoundFile)' Like '*qvd_*' Then
// Data:
Load *
FROM [$(FoundFile)] (qvd);
End If

Next FoundFile

 

// Sub folder
For Each SubDirectory in Dirlist( Root & '\*' )
Call ScanFolder(SubDirectory)
Next SubDirectory

 

End Sub

 

Call ScanFolder('D:') ;    // NOT SURE about what to put here?

So far, nothing happens. Please advise me 😕