Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
crusader_
Partner - Specialist
Partner - Specialist

Table with Field List

Hi Community,

I have an interesting issue.

I have a fact table with several columns and I want to create a table which will include NAMEs of all of this fields.

I made it like this

[Main]:

LOAD

     Field1

     ,   Field2

     ,   Field3

     ,   Field4

     ,   Field5

     ,   Field6

     ,   Field7;

SQL EXEC sp_123;

T1:

LOAD 1 as Key

AUTOGENERATE 1;

Fields:

LOAD IterNo() as Key

          ,  FieldName(IterNo(),'Main') as FieldName

resident T1

While IterNo()<=NoOfFields('Main');

But it doesn't work.

The result is table with 2 fields: empty (means NULL) and (1,2,3...7)

Interesting fact that if I make a variable

LET FieldN=FieldName(4,'Main');

FieldN will be equal Field4.

Is it possible to use IterNo() inside FieldName() function?

Or suggest other approach.

Using QV10.

Thanks,

Any help will be appreciated.

1 Solution

Accepted Solutions
Not applicable

for i=1 to NoOfFields('childs')

Fields: 

LOAD $(i) as Key 

          ,  FieldName($(i),'childs') as FieldName  AutoGenerate(1);

NEXT

This is not manual work.

You use loop.

In my case it works for table 'childs'.

I tryed it, ad have as much rows, as my table 'childs' has columns....

View solution in original post

6 Replies
Not applicable

Hello,

don't you have in QV10 $Field, $Table system fields?

regards

Darek

crusader_
Partner - Specialist
Partner - Specialist
Author

Dear Darek,

Thanks a lot for your response.

Thanks for fresh view as well .

But still, I'm interested in IterNo() inside FieldName() function. Are there any restrictions in using IterNo()?

Not applicable

For me it looks, like it can not resolve value from load context inside FieldName.... But I have not book knowledge in this area

Why not to use something like this:

for i=1 to NoOfFields('childs')

Fields: 

LOAD $(i) as Key 

          ,  FieldName($(i),'childs') as FieldName  AutoGenerate(1);

NEXT

crusader_
Partner - Specialist
Partner - Specialist
Author

I've already tried to make this way.

But in the result I got a lot of different tables.

Manual concatenating does not seems to me attractive.

Not applicable

for i=1 to NoOfFields('childs')

Fields: 

LOAD $(i) as Key 

          ,  FieldName($(i),'childs') as FieldName  AutoGenerate(1);

NEXT

This is not manual work.

You use loop.

In my case it works for table 'childs'.

I tryed it, ad have as much rows, as my table 'childs' has columns....

crusader_
Partner - Specialist
Partner - Specialist
Author

Oh, I forgot about QUALIFY statement above.

Yes, correct, I got the same result as you described.