Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
cspencer3
Creator II
Creator II

Field Names into New Table

Is there a way to get the field names of tables previously loaded in the load script into a new table? I was thinking of maybe some way of using a cross table and a resident load, but I could be completely off the mark. Basically just looking to get the names of each field as rows of a new table. I know in SQL you can get field values using system schema tables, but unfamiliar if there is a way in QlikView.

1 Solution

Accepted Solutions
datanibbler
Champion
Champion

Hi,

sure: You can use the NoOfFields() function to find out how many fields the table you have just loaded has and then use the FieldName() function in a loop to add to a new table the name of every field in that table.

Do all that in a FOR EACH loop or in a subroutine if you have several tables to process.

HTH

Best regards,

DataNibbler

View solution in original post

6 Replies
datanibbler
Champion
Champion

Hi,

sure: You can use the NoOfFields() function to find out how many fields the table you have just loaded has and then use the FieldName() function in a loop to add to a new table the name of every field in that table.

Do all that in a FOR EACH loop or in a subroutine if you have several tables to process.

HTH

Best regards,

DataNibbler

marcus_sommer

You could use table functions like nooffields() and fieldname(). Maybe in a loop through nooftables().

- Marcus

nagaiank
Specialist III
Specialist III

Did you try generating the 'System Table' which has the information on all the tables and fields?

rustyfishbones
Master II
Master II

Hi Charles,

Are you trying to then store the Field Names into a qvd file?

Where are you taking the Data from? Is it a DB or a QVD file

Regards

Alan

rustyfishbones
Master II
Master II

Hi Charles,

You could try using SQLCOLUMNS;

CONNECT to ......

Test:

SQLCOLUMNS;

STORE Test INTO Test.qvd(qvd);

You will get a file with details of the Tables and fields from the Database you are connecting to.

I hope that helps

Regards

Alan

example image below

2014-11-18_1623.png

cspencer3
Creator II
Creator II
Author

I am pulling data from a SQL Server Database, and I would just be storing and using those fields in the QVW itself. It looks like you guys all have great answers. I think that Data nibbler is the best option, and although it is a bit more complex than using the SQLColumns method, it gets only column names that are in my QVW not the whole DB. I really like the SQLColumns feature though, and it opens up a whole bunch of other data that may be useful in the future. Thanks Everyone!