Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
julioarriaga
Creator II
Creator II

Why I can't use an Order By clausule in a qvd load?

I know it is not possible, but I just want to know the design reason.

Thanks in advance.

1 Solution

Accepted Solutions
marcus_sommer

This behaviour is not directly related to a qvd-load else to each load of external data. The reason is the special data-format in which qlik the data reads and stores which is internally the same as in qvd's - see here the comment from vishsaggi‌.

This means there are not really data on a record-level else the record contained only the pointers to the symbol-tables. I think the load-statement could logically be extended with some intermediate steps (each tool/logic will need at least one intermediate step) to cover this measure - but I believe it would be much slower as loading the data first and order them within a second step (resident load).

For convenience it might be included within the load-parameters and then trigger a hidden load with a temporary table but in my opinion it wouldn't be really useful because it would hide an important part of the qlik mechanics for the user - and this understanding is an essential part to build datamodels properly.

- Marcus

View solution in original post

5 Replies
Chanty4u
MVP
MVP

you can try this way

ssample code looks like this

Temp:

Load  *

from C:\QlickView\Dashboard\PATIENTLEVELDATA_4.QVD (qvd);

PATIENTLEVELDATA:

Load  *,1 as Flag

Resident Temp Order By RECDATE;

Drop table Temp;

Chanty4u
MVP
MVP

try this

TempTable:

LOAD [QWT Budget],

     F2,

     F3,

     F4,

     F5,

     F6,

     F7

FROM

(qvd);

Data:

LOAD

   *

RESIDENT TempTable

ORDER BY F2;

exit Script;

Anil_Babu_Samineni

I really don't know the proper answer. But, We can expect something from rwunderlich

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
vishsaggi
Champion III
Champion III

I believe this could be the reason you cannot do an order by with field list on a qvd load.

Ref: https://help.qlik.com/en-US/qlikview/November2017/Subsystems/Client/Content/QVD_files.htm

A QVD file holds exactly one data table and consists of three parts:

  1. A well formed XML header (in UTF-8 char set) describing the fields in the table, the layout of the subsequent information and some other meta-data.
  2. Symbol tables in a byte stuffed format.
  3. Actual table data in a bit-stuffed format.

So when you load the table from qvd it will do an optimized load if no conditions were given. Then after you load qvd into a table using Resident load as the table is already loaded into memory as a standard table on which you can do an order by to sort.

This is what i believe that happens internally.

marcus_sommer

This behaviour is not directly related to a qvd-load else to each load of external data. The reason is the special data-format in which qlik the data reads and stores which is internally the same as in qvd's - see here the comment from vishsaggi‌.

This means there are not really data on a record-level else the record contained only the pointers to the symbol-tables. I think the load-statement could logically be extended with some intermediate steps (each tool/logic will need at least one intermediate step) to cover this measure - but I believe it would be much slower as loading the data first and order them within a second step (resident load).

For convenience it might be included within the load-parameters and then trigger a hidden load with a temporary table but in my opinion it wouldn't be really useful because it would hide an important part of the qlik mechanics for the user - and this understanding is an essential part to build datamodels properly.

- Marcus