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

Announcements
Discover how organizations are unlocking new revenue streams: Watch here
cancel
Showing results for 
Search instead for 
Did you mean: 
manojkulkarni
Partner - Specialist II
Partner - Specialist II

Script to Generate Tables from template

Hi All,

I am looking for script from which we can generate tables & columns skeleton using provided excel. Excel will have schema of table.

Below is the sample data present in excel. At the end of load, i should have 3 tables in my QVW. Please share if anybody had script to do the same or any suggestions also welcome.

 

TableNameColumns
Table1Col1
Col2
Col3
Col4
Table2Col21
Col22
Col23
Col24
Table3Col31
Col32
Col33
4 Replies
avinashelite

could you please share the sample data format along with the output format so that we can help you out with the script to generate the data

its_anandrjs
Champion III
Champion III

Please provide your sample file.

Regards

Anand

manojkulkarni
Partner - Specialist II
Partner - Specialist II
Author

input would be below data in excel and expected output will be 3 tables get created in my qlikview application.

TableNameColumns
Table1Col1
Col2
Col3
Col4
Table2Col21
Col22
Col23
Col24
Table3Col31
Col32
Col33
sebastianlettner
Partner - Creator
Partner - Creator

Hi,

is that what you are looking for?

ExcelTables:

LOAD

    RowNo() as row,

    TableName,

    Columns

FROM

[..\..\..\Desktop\Demo.xlsx]

(ooxml, embedded labels, table is Tabelle1);

TableBase:

LOAD

    if(len(trim(TableName)) = 0, Peek('TableName'), TableName) as TableName,

    Columns

Resident ExcelTables

Order By row asc;

drop table ExcelTables;

LoadColumns:

LOAD

    TableName,

    Concat(Columns, ',') as ColumnsString

Resident TableBase

Group By TableName;

drop table TableBase;

For i=0 to NoOfRows('LoadColumns')

    let _TN = Peek('TableName', i, 'LoadColumns');

    let _COLS = Peek('ColumnsString', 1, 'LoadColumns');

   

    $(_TN):

    LOAD

        $(_COLS)

    FROM $(_TN).qvd (qvd)  

    Resident $(_TN)                     

    ;SQL SELECT $(_COLS) FROM $(_TN);  

    //WhatEverYouNeed 

   

NEXT;

Let _TN = NULL();

Let _COLS = NULL();

Regards

Sebastian Lettner