Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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.
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....
Hello,
don't you have in QV10 $Field, $Table system fields?
regards
Darek
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()?
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
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.
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....
Oh, I forgot about QUALIFY statement above.
Yes, correct, I got the same result as you described.