Qlikview SQL查询

时间:2017-07-14 15:01:17

标签: sql load qlikview

Qlikview的新功能,我尝试将一个表中的列合并到一个新列表中,列数较少但行数较多。

这个的最佳选择是什么? 任何帮助都赞赏enter image description here

1 个答案:

答案 0 :(得分:0)

解决问题的一种方法是通过脚本循环。请参阅以下示例:

//input table
table:
load * Inline [
n, d, t1, v1, t2, v2, t3, v3
Bob, 07-jul, a, 1, b, 2, c, 3
];

//Use dummy field to setup result table.
result:
Load * Inline [DUMMY];

//Set starting position.
set k=3;

do WHILE k <= NoOfFields('table')

    //result table need to exist pre loop.
    Concatenate(result) Load
        n as name,
        d as date,          
        peek(FieldName($(k),'table'),0,'table') as text,
        peek(FieldName($(k)+1,'table'),0,'table') as value          
    resident table;     

    let k = $(k)+2;

loop    

drop field DUMMY;