Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

lmonincx
Contributor 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

Tags (1)
1 Reply

Re: How to skip values in for .. next loops

Hi Linda,

Try this,

X:
LOAD ID,  1 as QTY

While IterNo()<= QTY;

LOAD * INLINE [

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

];

Community Browser