Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Announcements
Qlik Analytics Tour 2020 Online. Begins August 10th. Register Today
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Partner
Partner

How to dynamically create fields

Hello,

I need create fields dynamically using 'for'.

Obs.: Always have Subject 1

I try:

Table:

LOAD * INLINE [

    Category, Category_desc  

    1234, English

    1234, Maths

    1234, French

    2345, French

    2334, English       

];

Table1:

Load

Category as ID,

Category_desc as Subject1

Resident Table

Where Not Category = Previous(Category)

Order By Category, Category_desc;

let vRow = NoOfRows(ID);

for i = 2 to '$(vRow)'

  Left Join (Table1)

  LOAD

  Category as ID,

  Category_desc as 'Subject$(i)'

  Resident Table

  WHERE Category = Previous(Category)

  Order By Category, Category_desc;

Next

Drop Table Table;

But, something's wrong, any help?

1 Solution

Accepted Solutions
Highlighted
Champion III
Champion III

Re: How to dynamically create fields

It should not be NoOfRows(ID). NoOfRows function takes Table name not the Field name so try like

let vRow = NoOfRows('Table1');

View solution in original post

3 Replies
Highlighted
Champion III
Champion III

Re: How to dynamically create fields

It should not be NoOfRows(ID). NoOfRows function takes Table name not the Field name so try like

let vRow = NoOfRows('Table1');

View solution in original post

Highlighted
Partner
Partner

Re: How to dynamically create fields

Ohhhh simple mistake

Thank You!

Highlighted
Champion III
Champion III

Re: How to dynamically create fields

NO problem.