Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
markgraham123
Specialist
Specialist

Auto generate in Scripting

Hi,

I'm working on a req. where i have

WHen i select Country A, i wanna display 1, 2, 3, 4, 5

So, here i wanna use a logic which helps to recognize number ranges between 1 and 5.

1 Solution

Accepted Solutions
hic
Former Employee
Former Employee

LOAD Area,

     From,

     To,

     From - 1 + IterNo() as Number

FROM Book2.xlsx (ooxml, embedded labels, table is Sheet1)

     While IterNo() <= To - From + 1;

View solution in original post

4 Replies
hic
Former Employee
Former Employee

LOAD Area,

     From,

     To,

     From - 1 + IterNo() as Number

FROM Book2.xlsx (ooxml, embedded labels, table is Sheet1)

     While IterNo() <= To - From + 1;

JonnyPoole
Former Employee
Former Employee

I used a loop to autogenerate all the values between from and to for each row of the data

The result is that you can see the full association of data in the UI:

Capture.PNG

Temp:

LOAD Area,

     From,

     To

FROM

(biff, embedded labels, table is Sheet1$);

let vNumRows=NoOfRows('Temp');

for i=0 to $(vNumRows)-1

  let vStart=peek('From',$(i),'Temp');

  let vEnd=peek('To',$(i),'Temp');

  let vNumRowsToGenerate=$(vEnd)-$(vStart)+1;

  load

  Peek('Area',$(i),'Temp') as Area,

  recno()-1+$(vStart) as Value

  AutoGenerate $(vNumRowsToGenerate);

next i;

drop table Temp;

markgraham123
Specialist
Specialist
Author

Thanq Jonathan.

It worked

markgraham123
Specialist
Specialist
Author

Thanq Henric.

It worked