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

How to get a list of fields in load script?

Hi community,

I am sure there is a way, but can someone let me know if I would like to get a list of field name of a table in a load script, how would l do that? For example, I have a resident table TABLE_A, and I would like to query all of its fields, and store it in another resident table.

Thank you.

1 Solution

Accepted Solutions
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

This will work for a table named "Customers"

FOR i = 1 to NoOfFields('Customers')

Fields:

LOAD

  FieldName($(i),'Customers') as FieldName

AutoGenerate 1

;

NEXT i

-Rob

View solution in original post

19 Replies
tresesco
MVP
MVP

Like this, using '*' ?

Tab2:

Load  * resident TABLE_A;

Not applicable
Author

Table1:

load * from Table1;

Table2:

load * resident Table1;

store Table2 into D:\Table2.qvd (qvd);

Drop table Table1;

Not applicable
Author

I think this just loads Table_A into Tab2. What I need is, suppose TABLE_A has 50 columns ('COL1',...,'COL50'), I would like to create a table with 1 column and 50 rows where row1 = 'COL1', row2 = 'COL2' and so forth.

Not applicable
Author

hi

try to use Crosstable concept

Not applicable
Author

I used crosstable which somewhat works, but just wondering if there is a function or another way to get the list of fields.

Not applicable
Author

hi

try according to this

Crosstable(NewCol, value)

load

Rowno() as key,

Col1,

Col2,

Col3,

..

..

..

Col50

Resident tablename;

Not applicable
Author

Have you tried transposing the fields?

Not applicable
Author

Hi there,

I am sure what you mean by "transposing the fields"? Are you referring to Crosstable functionality?

Not applicable
Author

Hi Shyamal,

sorry, I meant "not sure". Typo.