Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Looping in script

Hi People,

I'm tring to loop in the script and i'm founding a few erros.

tab1:

Load ID

From (...);

// ID is a filed name with ID codes

Them i want to:

for i=1 to noOfRows('tab1')

               Let a=fieldvalue(ID,i);

Load A

from (..... $(a).xlsx) ;

I'm having problems with this so a also tried to numerate the xlsx files from 1 to 10 and

for i=1 to 10

Load A

from (...$(i).xlsx) ;

and didnt work as well.

Can someone help?

Regards,

Eliano

3 Replies
tresesco
MVP
MVP

Hello Eliano,

Well, what you tried is clear but what you want is not. can you explain with an exmple what you want?

Regards,  tresesco

Not applicable
Author

Hello Eliano,

The basic syntax that you need to use is:

FOR i = 1 to NoOfRows('tab1')

LET a = fieldvalue('ID', $(i)) ;

// ENTER YOUR CODE HERE

NEXT

In both of your examples you dont have the NEXT statement. Also remember that you need to use the dollar expansion around your variable.

Hope this helps.

Not applicable
Author

Sorry about the delay.

The problem, as you mencioned was with the next operator.

Many thanks for both of you.