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

Announcements
ALERT: QlikView server communication interruptions following Microsoft Windows Domain Controller security updates
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Field should come as a table

Dear All,

i have a excel table in that 30 fields are there. when i load the same into qlikview then i ll get a single table in Data model.

but in my case i want all that 30 fields into a individual table in data model (30 seperate tables - Each table consists of Key field and field) with the fact table in it. (like star schema) .

Also if one more field in excel added in future that too should get added in data model as a table.

Labels (1)
4 Replies
sujeetsingh
Master III
Master III

Use resident load in the script:

Main Data:

Load

Field1,Autohash(Field1) as Key1

,Field2' ,Autohash(Field2) as Key2

,

,

Field30,Autohash(Field30) as Key30

from file xls;

Table1:

Load

Key1

,Field1 as First_Field

resident MainData;

Table2:

Load

Key2

,Field2 as Second_Field

resident MainData;

---

--

--

--

--

Similarly for all 30

Not applicable
Author

Hi Logesh:

I think you can use metadata to extract all the names of the fields you want to make individual tables.

     - I am not sure if you can read metadata of an excel file in Qlikview directly but I am sure you can read metadata from QVD files

     - And then you can filter out the Key fields and keep the fields you want to make individual tables

Concatenate them using CONCAT() with single quotes and comma.

     -Something like CONCAT(chr(39) & [Field Names] & chr (39),',') AS [Concat Field Names]

And then use FOR EACH ... IN ... to loop through all the names and create a single table in each loop.

     - Something like

     FOR EACH vField IN $(Concat Field Names)

          [$(vField)]:

          NoConcatenate

          LOAD

               [Key Field 1],

               [Key Field 2],

               ...

               [$(vField)]

          FROM ...

     NEXT

I think in this case, even if you add in new fields the new table will generate automatically.

Above scripts may not be exact and I haven't test it before. Just a suggest on top of my head

Thanks.

PC

Not applicable
Author

Actually I am not sure how is your Fact table would look like.

If you need multiple key fields for individual tables, above script will create synthetic fields. So maybe concatenate them instead of what I just wrote.

So instead of using

[Key Field 1],

[Key Field 2]

...

You can use

[Key Field 1] & '-' & [Key Field 2] & '-' & [Key Field 3]...

hariprasadqv
Creator III
Creator III

No automatic loading and data trasformation is available. I thinkl. you can try ETL tool of the QV in data loading. Or you can harcod it like sujeet's approach.