6 Replies Latest reply: Apr 9, 2014 9:14 AM by Andrei Kaliahin RSS

    Table with Field List

    Andrei Kaliahin

      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.