Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
lmonincx
Creator II
Creator II

How to skip values in for .. next loops

Hi,

I am trying to change my table , which is having a quatity of 1 to 5 into a tabel with single rows for each Quantity

for example

ID  QTY

A    1

B    2

C    5

in to

ID QTY

A   1

B   1

B   1

C   1

C   1

C   1

C   1

C   1

If have the below script working but it is also doing the load for number 3 and 4, I don't want to script running for values which don't exist

any idea, this is just a small example in realtime i have High Qty exceptions ?

vMax=5;

For i = num(1,00) to num($(vMax))
for j= 1 to $(i)

Table:

ID,

QTY

resident x where QTY=$(i);

next

next

1 Reply
tamilarasu
Champion
Champion

Hi Linda,

Try this,

X:
LOAD ID,  1 as QTY

While IterNo()<= QTY;

LOAD * INLINE [

ID, QTY
A, 1
B, 2
C, 5

];