Qlikview генерирует QVD по месяцам - PullRequest
       10

Qlikview генерирует QVD по месяцам

0 голосов
/ 03 сентября 2018

Я соединю две таблицы с левым соединением и сгенерирую qvd. Я хотел бы создать QVD на основе месяца даты. Например, если с января по декабрь существует 12 дат, тогда будет 12 файлов qvd.

1 Ответ

0 голосов
/ 03 сентября 2018

Вы можете просмотреть все значения в поле Month. Каждая итерация будет загружать данные из TEMP_TABLE1 в течение одного месяца и сохраните эту временную таблицу в файле qvd.

Сценарий ниже может дать вам представление о том, как этого можно достичь

// Load some data
RandData:
Load 
  *
Inline [
Value , Month
1     , Jan
2     , Feb
3     , Mar
4     , Apr
5     , May
6     , Jun
7     , Jul
8     , Aug
9     , Sep
10    , Oct
11    , Nov
12    , Dec
];

// Start looping through each distinct value in the Month field
for i = 1 to FieldValueCount('Month')
    // In-loop variable that will get the current increment value from the Month field
    let sMonhValue = FieldValue('Month', $(i));
    trace Storing data for Month --> $(sMonhValue);

    // NoConcatenate is used to tell Qlik to not concatenate the same tables
    NoConcatenate

    // Load the data for the current iteration month from the main data table
    TempTable:
    Load
      *
    Resident
      RandData
    where
      Month = $(i)
    ;

    // Store one month data in qvd. The name of the qvd will include the month value        
    Store TempTable into RandData_$(sMonhValue).qvd;

    // The Store statement above will store the qvd files next to the qvw file. 
    // If the qvd files need to be stored somewhere else - just provide the path like:
    //Store TempTable into c:\users\UserName\Documents\RandData_$(sMonhValue).qvd;

    // Drop the temp table. Otherwise it will get concatenated to the "previos" temp table 
    Drop Table TempTable;
next

// At the end the app will contain only one table - `RandData`
...