我加入左表连接的两个表,将生成qvd。我想根据日期月份生成qvd。例如,如果从jan到dec有12个日期,那么将有12个qvd文件。
您可以查看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`