Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

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
vishsaggi
Esteemed Contributor 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');

3 Replies
vishsaggi
Esteemed Contributor 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');

Partner
Partner

Re: How to dynamically create fields

Ohhhh simple mistake

Thank You!

vishsaggi
Esteemed Contributor III

Re: How to dynamically create fields

NO problem.